You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7fb3aa6
Browse filesBrowse the repository at this point in the historyBrowse files
Expose the controller's /metrics endpoint through a dedicated Service (#1803)
Operators deploying through this chart can now point Prometheus,
VictoriaMetrics, or any other authenticated scraper at the controller's
`/metrics` endpoint without hand-rolling a Service, ClusterRoles, and a
binding. The controller binary already understands
`--metrics-bind-address` and `--metrics-secure` via flags or env vars
(the env-var loader at `go/core/pkg/app/app.go` translates every flag
automatically), but the chart had no way to surface the endpoint short
of stuffing values into `controller.env` and writing the missing Service
and RBAC by hand. Closes#1369.
The shape mirrors the `kmcp` sub-chart that already lives in this same
umbrella: a separate `<fullname>-controller-metrics` Service exposing
`https:8443`, two ClusterRoles (`metrics-auth-role` granting the
controller's ServiceAccount the right to call `TokenReview` and
`SubjectAccessReview` against the API server; `metrics-reader` granting
`get` on the `/metrics` non-resource URL), and a ClusterRoleBinding
wiring only the auth role to the controller. The reader role is
deliberately left unbound — picking a subject (Prometheus,
VictoriaMetrics, an OpenTelemetry collector) belongs to the cluster
operator, not the chart. This is also what `kubebuilder` and
`operator-sdk` scaffold by default, for the same reason.
The auth role and its binding are gated additionally on
`controller.metrics.secureServing` because they're no-ops when the
authn/authz filter isn't installed. The deployment's existing
`controller.env` pass-through still wins over the chart-supplied
defaults (the conditional env vars are emitted before the user-supplied
list), so anyone who needs `METRICS_BIND_ADDRESS=0` for debugging or
`--metrics-cert-path` wired through `volumes`/`volumeMounts` retains the
escape hatch.
Designed exclusions: `ServiceMonitor` is deferred — it pulls in a
Prometheus-Operator coupling the rest of the chart has avoided, and it's
straightforward to layer on top once the underlying Service exists,
gated on `controller.metrics.serviceMonitor.enabled`.
Cert-manager-issued metrics certificates are also out of scope;
controller-runtime's self-signed default works for in-cluster scrapers
that skip TLS verification or trust the kubelet CA, and the existing
cert-path flags remain reachable via `controller.env` for those who want
to wire their own. Default is opt-in (`controller.metrics.enabled:
false`), so existing installations are unchanged.
---------
Signed-off-by: Daniel Orbach <[email protected]>
0 commit comments