{
  "description": "KeycloakInstance makes a Keycloak server known to the operator",
  "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": "KeycloakInstanceSpec defines the desired state of KeycloakInstance",
      "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": "ClientCredentials configures OAuth2 client_credentials grant\nauthentication via a confidential client / service account.",
              "properties": {
                "clientId": {
                  "description": "ClientID, when set, overrides the value read from secretRef.clientIdKey.\nThe client ID is not a secret, so providing it inline is allowed.",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "secretRef": {
                  "additionalProperties": false,
                  "description": "ClientCredentialsSecretRefSpec references a Secret containing client credentials.",
                  "properties": {
                    "clientIdKey": {
                      "default": "client-id",
                      "description": "ClientIdKey is ignored when ClientCredentialsSpec.ClientID is set.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "clientSecretKey": {
                      "default": "client-secret",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "namespace": {
                      "description": "Namespace defaults to the KeycloakInstance namespace when unset.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "name"
                  ],
                  "type": "object"
                }
              },
              "required": [
                "secretRef"
              ],
              "type": [
                "object",
                "null"
              ]
            },
            "passwordGrant": {
              "additionalProperties": false,
              "description": "PasswordGrant configures resource-owner password grant authentication\nagainst a user account (typically the master-realm admin).",
              "properties": {
                "secretRef": {
                  "additionalProperties": false,
                  "description": "PasswordGrantSecretRefSpec references a Secret containing admin credentials.",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "namespace": {
                      "description": "Namespace defaults to the KeycloakInstance namespace when unset.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "passwordKey": {
                      "default": "password",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "usernameKey": {
                      "default": "username",
                      "description": "UsernameKey is ignored when PasswordGrantSpec.Username is set.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "name"
                  ],
                  "type": "object"
                },
                "username": {
                  "description": "Username, when set, overrides the value read from secretRef.usernameKey.\nThe admin username is not a secret, so providing it inline is allowed.",
                  "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": "CACert references a Secret or ConfigMap holding a PEM-encoded CA bundle\nused to verify the Keycloak server certificate.",
              "properties": {
                "configMapRef": {
                  "additionalProperties": false,
                  "description": "CACertConfigMapRefSpec references a ConfigMap key holding a PEM-encoded CA\nbundle (e.g. kube-root-ca.crt or a cert-manager CA bundle).",
                  "properties": {
                    "key": {
                      "default": "ca.crt",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "namespace": {
                      "description": "Namespace defaults to the KeycloakInstance namespace when unset.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "name"
                  ],
                  "type": [
                    "object",
                    "null"
                  ]
                },
                "secretRef": {
                  "additionalProperties": false,
                  "description": "CACertSecretRefSpec references a Secret key holding a PEM-encoded CA bundle.",
                  "properties": {
                    "key": {
                      "default": "ca.crt",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "namespace": {
                      "description": "Namespace defaults to the KeycloakInstance namespace when unset.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "name"
                  ],
                  "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": {
              "description": "InsecureSkipVerify disables TLS certificate verification. Do not enable\nin production.",
              "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": "KeycloakInstanceStatus defines the observed state of KeycloakInstance",
      "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"
}