Extend documentation on ServiceMonitor creation (#45071)

The documentation so far only mentions how to disable the ServiceMonitor, leading to the assumption that it is enabled by default.

Getting a service monitor created also requires enabling metrics in keycloak, though:

658faf210f/operator/src/main/java/org/keycloak/operator/controllers/KeycloakServiceMonitorDependentResource.java (L50)

While the missing setting creates a warning, the administrator should already have this information before applying the configuration.

Closes #45070

Signed-off-by: Jens Erat <email@jenserat.de>
This commit is contained in:
Jens Erat 2026-01-05 09:10:18 +01:00 committed by GitHub
parent f2c527239d
commit adeb41e82b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -544,6 +544,21 @@ The {project_name} Operator automatically generates a `ServiceMonitor` resource
`ServiceMonitor` resource to be created, the `monitoring.coreos.com/v1:ServiceMonitor` Custom Resource Definition (CRD)
must be installed on your {kubernetes} cluster.
A ServiceMonitor is only created if the `metrics-enabled` option is set.
.Enable Keycloak metrics
[source,yaml]
----
apiVersion: k8s.keycloak.org/v2alpha1
kind: Keycloak
metadata:
name: example-kc
spec:
additionalOptions:
- name: metrics-enabled
value: "true"
----
The Operator generates a `ServiceMonitor` with the following spec:
.Default ServiceMonitor