{
  "description": "ClusterKeycloakInstance makes a Keycloak server known to the operator at the cluster level",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": [
        "string",
        "null"
      ]
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": [
        "string",
        "null"
      ]
    },
    "metadata": {
      "type": [
        "object",
        "null"
      ]
    },
    "spec": {
      "additionalProperties": false,
      "description": "ClusterKeycloakInstanceSpec defines the desired state of ClusterKeycloakInstance.\nIt mirrors KeycloakInstanceSpec but is cluster-scoped: secret references must\nspecify a namespace explicitly.",
      "properties": {
        "auth": {
          "additionalProperties": false,
          "description": "Auth selects how the operator authenticates to Keycloak.\nExactly one of auth.passwordGrant or auth.clientCredentials must be set.",
          "properties": {
            "clientCredentials": {
              "additionalProperties": false,
              "description": "ClusterClientCredentialsSpec configures OAuth2 client_credentials\nauthentication for cluster-scoped instances.",
              "properties": {
                "clientId": {
                  "description": "ClientID, when set, overrides secretRef.clientIdKey.",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "secretRef": {
                  "additionalProperties": false,
                  "description": "ClusterClientCredentialsSecretRefSpec references a client-credentials Secret.\nNamespace is required because the resource is cluster-scoped.",
                  "properties": {
                    "clientIdKey": {
                      "default": "client-id",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "clientSecretKey": {
                      "default": "client-secret",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "namespace": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "name",
                    "namespace"
                  ],
                  "type": "object"
                }
              },
              "required": [
                "secretRef"
              ],
              "type": [
                "object",
                "null"
              ]
            },
            "passwordGrant": {
              "additionalProperties": false,
              "description": "ClusterPasswordGrantSpec configures password-grant authentication\nfor cluster-scoped instances.",
              "properties": {
                "secretRef": {
                  "additionalProperties": false,
                  "description": "ClusterPasswordGrantSecretRefSpec references an admin-credentials Secret.\nNamespace is required because the resource is cluster-scoped.",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "namespace": {
                      "type": "string"
                    },
                    "passwordKey": {
                      "default": "password",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "usernameKey": {
                      "default": "username",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "name",
                    "namespace"
                  ],
                  "type": "object"
                },
                "username": {
                  "description": "Username, when set, overrides secretRef.usernameKey.",
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "secretRef"
              ],
              "type": [
                "object",
                "null"
              ]
            }
          },
          "type": "object",
          "x-kubernetes-validations": [
            {
              "message": "exactly one of auth.passwordGrant or auth.clientCredentials must be set",
              "rule": "has(self.passwordGrant) != has(self.clientCredentials)"
            }
          ]
        },
        "baseUrl": {
          "description": "BaseUrl is the URL of the Keycloak server (e.g., http://keycloak:8080)",
          "type": "string"
        },
        "realm": {
          "description": "Realm is the admin realm (defaults to \"master\")",
          "type": [
            "string",
            "null"
          ]
        },
        "tls": {
          "additionalProperties": false,
          "description": "TLS configures how the operator verifies the Keycloak server certificate.",
          "properties": {
            "caCert": {
              "additionalProperties": false,
              "description": "ClusterCACertSource references a Secret or ConfigMap key containing a\nPEM-encoded CA bundle. Exactly one of secretRef or configMapRef must be set.",
              "properties": {
                "configMapRef": {
                  "additionalProperties": false,
                  "description": "ClusterCACertConfigMapRefSpec is the cluster-scoped variant; namespace required.",
                  "properties": {
                    "key": {
                      "default": "ca.crt",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "namespace": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "name",
                    "namespace"
                  ],
                  "type": [
                    "object",
                    "null"
                  ]
                },
                "secretRef": {
                  "additionalProperties": false,
                  "description": "ClusterCACertSecretRefSpec is the cluster-scoped variant; namespace required.",
                  "properties": {
                    "key": {
                      "default": "ca.crt",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "namespace": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "name",
                    "namespace"
                  ],
                  "type": [
                    "object",
                    "null"
                  ]
                }
              },
              "type": [
                "object",
                "null"
              ],
              "x-kubernetes-validations": [
                {
                  "message": "exactly one of caCert.secretRef or caCert.configMapRef must be set",
                  "rule": "has(self.secretRef) != has(self.configMapRef)"
                }
              ]
            },
            "insecureSkipVerify": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          "type": [
            "object",
            "null"
          ]
        },
        "token": {
          "additionalProperties": false,
          "description": "Token contains optional token caching configuration",
          "properties": {
            "expiresKey": {
              "description": "ExpiresKey is the key in the secret for the token expiration",
              "type": [
                "string",
                "null"
              ]
            },
            "secretName": {
              "description": "SecretName is the name of the secret to cache the token",
              "type": [
                "string",
                "null"
              ]
            },
            "tokenKey": {
              "description": "TokenKey is the key in the secret for the token",
              "type": [
                "string",
                "null"
              ]
            }
          },
          "type": [
            "object",
            "null"
          ]
        }
      },
      "required": [
        "auth",
        "baseUrl"
      ],
      "type": [
        "object",
        "null"
      ]
    },
    "status": {
      "additionalProperties": false,
      "description": "ClusterKeycloakInstanceStatus defines the observed state of ClusterKeycloakInstance",
      "properties": {
        "conditions": {
          "description": "Conditions represent the latest available observations",
          "items": {
            "additionalProperties": false,
            "description": "Condition contains details for one aspect of the current state of this API Resource.",
            "properties": {
              "lastTransitionTime": {
                "description": "lastTransitionTime is the last time the condition transitioned from one status to another.\nThis should be when the underlying condition changed.  If that is not known, then using the time when the API field changed is acceptable.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "message is a human readable message indicating details about the transition.\nThis may be an empty string.",
                "maxLength": 32768,
                "type": "string"
              },
              "observedGeneration": {
                "description": "observedGeneration represents the .metadata.generation that the condition was set based upon.\nFor instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date\nwith respect to the current state of the instance.",
                "format": "int64",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              },
              "reason": {
                "description": "reason contains a programmatic identifier indicating the reason for the condition's last transition.\nProducers of specific condition types may define expected values and meanings for this field,\nand whether the values are considered a guaranteed API.\nThe value should be a CamelCase string.\nThis field may not be empty.",
                "maxLength": 1024,
                "minLength": 1,
                "pattern": "^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$",
                "type": "string"
              },
              "status": {
                "description": "status of the condition, one of True, False, Unknown.",
                "enum": [
                  "True",
                  "False",
                  "Unknown"
                ],
                "type": "string"
              },
              "type": {
                "description": "type of condition in CamelCase or in foo.example.com/CamelCase.",
                "maxLength": 316,
                "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$",
                "type": "string"
              }
            },
            "required": [
              "lastTransitionTime",
              "message",
              "reason",
              "status",
              "type"
            ],
            "type": "object"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "message": {
          "description": "Message contains additional information about the status",
          "type": [
            "string",
            "null"
          ]
        },
        "ready": {
          "description": "Ready indicates if the Keycloak instance is accessible",
          "type": "boolean"
        },
        "resourcePath": {
          "description": "ResourcePath is the API path for this resource",
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "description": "Status is a human-readable status message",
          "type": [
            "string",
            "null"
          ]
        },
        "version": {
          "description": "Version is the Keycloak server version",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "ready"
      ],
      "type": [
        "object",
        "null"
      ]
    }
  },
  "type": "object"
}