helm: add optional CRD-gated ServiceMonitor for the controller manager - #1865
Open
apurvapatkeshwar wants to merge 1 commit into
Open
helm: add optional CRD-gated ServiceMonitor for the controller manager#1865apurvapatkeshwar wants to merge 1 commit into
apurvapatkeshwar wants to merge 1 commit into
Conversation
First slice of the observability starter pack (michelangelo-ai#1692): a monitoring toggle (default off) that creates a ServiceMonitor for controllermgr's /metrics endpoint. The resource is gated on the Prometheus Operator CRDs being present, so enabling the toggle on a cluster without the operator is a safe no-op. Also fixes two drifts in the monitoring guide: the ServiceMonitor example used labels that do not match the chart's real selector labels, and the health-probe port is 8081 (chart default), not 8083. CI gains three template checks: monitoring-enabled render with the CRD API version present, graceful skip without it, and a negative test for the new monitoring-requires-controllermgr guard.
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (check all applicable)
What changed?
First slice of the observability starter pack (#1692): a
monitoring.enabledtoggle (default off) that creates aServiceMonitorfor the controller manager's/metricsendpoint -- the only component that exposes one today.The resource is gated on
.Capabilities.APIVersions.Has "monitoring.coreos.com/v1", so enabling the toggle on a cluster without the Prometheus Operator is a safe no-op -- matching the issue's "skipped when the operators are absent" intent. A validation guard fails fast ifmonitoring.enabled=truewithcontrollermgr.enabled=false.Two drive-by fixes in the monitoring guide, since this PR ships the exact resource it describes:
app: michelangelo-controllermgrlabel that doesn't match the chart's real selector labels (app.kubernetes.io/name/instance/component) -- corrected, and the guide now leads with the chart-managed path8081(chart defaultcontrollermgr.healthPort), not8083Follow-up PRs in this series: PrometheusRule starter alerts, GrafanaDashboard CRs, and a docs pass. The per-job scrape ConfigMap named in the issue (item 3) is deferred -- it needs
FederatedClient.CreatePromConfigMapcall-site work, which is a code change rather than installable YAML.Why?
#1692 lays out the gap: the chart deploys the platform with zero scrape configuration, alerts, or dashboards, and the monitoring guide asks operators to hand-write resources (with examples that do not match the chart's labels). This starts closing that gap with the smallest installable piece, wired the same way other optional chart features are.
How did you test it?
helm lintclean; all checks re-run on top of current main before posting.helm template -f values-k3d.yamloutput against a clean main worktree) -- strictly additive.selector.matchLabelsverified to exactly match the controllermgr Service's labels, and themetricsendpoint port name matches the Service port.helm-lint.yaml: monitoring-enabled render with--api-versions monitoring.coreos.com/v1asserts the resource renders; without it, asserts it is skipped; negative test for the controllermgr guard. All three verified locally with the exact CI invocations.Potential risks
.Capabilities.APIVersions, which is populated from the cluster on real installs but empty under barehelm template; anyone rendering manifests offline for a cluster that has the Prometheus Operator needs--api-versions monitoring.coreos.com/v1. The values comment says so.Breaking Changes
Release notes
Added an optional
monitoring.enabledchart toggle that creates a ServiceMonitor for the controller manager when the Prometheus Operator CRDs are present. Default off; no action needed for existing deployments. Also corrected the label selector and health-probe port in the monitoring guide's examples.Documentation Changes
docs/operator-guides/operations/monitoring.mdnow leads with the chart-managed ServiceMonitor path and its examples match the chart's real labels and ports.helm/michelangelo/README.mddocuments the new values.