Repository navigation
Conversation
mxsrc
force-pushed
the
prometheus-operator-migration
branch
from
October 8, 2026 13:41
864c4d1 to
b35ae4e
Compare
mxsrc
marked this pull request as draft
October 8, 2026 13:54
mxsrc
force-pushed
the
prometheus-operator-migration
branch
from
November 18, 2026 14:13
f5611a8 to
9260073
Compare
This was referenced Nov 20, 2026
boddumanohar
left a comment
Member
There was a problem hiding this comment.
the helm parameter prometheus.enabled looks a bit confusing. Prometheus is always needs to be present in the cluster.
In this PR, prometheus.enabled actually helps chose which prometheus to use. So probably something like:
prometheus.mode: Managed | External
would me more accurate?
Additionally I've created #957 so that upgrades from 26.3 keep working. Because those upgrades run with prometheus.enabled=false.
…prometheus-operator Lets a customer running their own prometheus-operator scrape this chart's targets via ServiceMonitor/PodMonitor objects instead of the bundled `prometheus` subchart's static scrape config. Gated behind `prometheusOperator.enabled`, mutually exclusive with `prometheus.enabled`, and failing fast when the monitoring.coreos.com CRDs aren't present. The webappapi Service carried no labels of its own, only a Pod selector, so a ServiceMonitor had nothing to match it by.
…own prometheus-operator Converts the Grafana-provisioned alert rules and contact points in controlplane_configmap.yaml into a PrometheusRule (all eleven rules, same expr/for/labels/annotations) and an AlertmanagerConfig built from the same controlplane.observability.grafana.notifications.* values, so a customer's own Alertmanager can route these alerts instead of Grafana's alerting engine. Independent of the previous commit's ServiceMonitor/PodMonitor objects: a customer can take the scrape config without the rules, or the rules without alert routing, since the PrometheusRule renders whenever prometheusOperator.enabled is true regardless of which (if any) notifications.* receiver is configured.
…block.io annotations Nothing reads prometheus.simplyblock.io/scrape|port|path: the bundled static prometheus.yml has no annotation-based (kubernetes_sd_configs) discovery, and the PodMonitor added for prometheus-operator selects storage node pods by the role=simplyblock-storage-node label, not by annotation. They predate both scrape paths and had no consumer in either. The test asserting these annotations could not have caught their removal: it rebuilds its "expected" pod by replaying injectSidecar and re-setting the same constants by hand, rather than reading them off the real admission patch, so it was checking its own fixture rather than the webhook's output. Also fixes two preexisting house-style findings the quality gate surfaced on this file (a British spelling, a misplaced closing quotation mark), unrelated to this change but in a file this commit already touches.
Same pattern as the rebalancer's PodMonitor: selects storage node pods by role=simplyblock-storage-node and scrapes a named container port rather than a fixed number, since each proxy binds its own RPC_PORT on the host network. Assumes the proxy-http port (added to the storage node pod template in the control-plane repo) and an unauthenticated /_meta/metrics are both in place.
…ur-own prometheus-operator
…ur-own prometheus-operator
…or only
This chart deployed its own prometheus-community/prometheus subchart as one
of two scrape paths, mutually exclusive with the bring-your-own
prometheus-operator path (ServiceMonitor/PodMonitor/ScrapeConfig/
PrometheusRule/AlertmanagerConfig). Removes the bundled path entirely, since
maintaining two ways to scrape the same targets only kept the gap between
them from ever being forced shut.
Removed:
- The `prometheus` Chart.yaml dependency and its vendored tarball.
- The entire `prometheus:` values block (server, alertmanager,
prometheus-pushgateway, prometheus-node-exporter, kube-state-metrics,
configmapReload, defaultBackend) except `simplyblock.{prometheusURL,
prometheusPORT}`, which Control Center's own Prometheus link still falls
back to and now defaults empty.
- The legacy `simplyblock-prometheus-config` static scrape ConfigMap
(controlplane_configmap.yaml), including its lookup-based preserve-on-
upgrade trick.
- The Thanos querier's per-replica --store= flags against the bundled
Prometheus's own thanos-sidecar (controlplane_deploy.yaml), which pointed
at StatefulSet pods nothing creates once the subchart is gone.
- The now-moot prometheus.enabled/prometheusOperator.enabled mutual-
exclusivity fail check.
Also corrected two assumptions the bundled subchart's existence had let the
code carry silently:
- managementapi.go's SB_K8S_METRICS_SERVICE_ACCOUNTS trusted the bundled
subchart's own ServiceAccount by default; with no bundled Prometheus ever
presenting that identity, the entry was dead weight. The management API
now trusts only identities the chart names via prometheusOperator's
configured account (SB_EXTRA_METRICS_SERVICE_ACCOUNTS), the same way
SB_K8S_ADMIN_SERVICE_ACCOUNTS already works.
- podspec.go's hardcoded PROMETHEUS_URL/PROMETHEUS_PORT (where the control
plane pushes what it measures) still names the bundled chart's old Service,
which nothing creates anymore. Left as-is and flagged in its own comment:
making this configurable is a separate change this commit does not make.
prometheus-operator is the only scrape path this chart supports now, so
there is no second `prometheus` value left to collide with: the old
prometheus.simplyblock.{prometheusURL,prometheusPORT} (Control Center's own
fallback) is folded in as a sibling of enabled/additionalLabels/interval/
serviceAccount under one prometheus: key, and every .Values.prometheusOperator
reference, fail-fast message, and prose mention is renamed to match.
…when enabled prometheus.enabled now needs nothing installed beforehand: it brings its own prometheus-operator (kube-prometheus-stack 92.2.0, condition: prometheus.enabled) by default — CRDs, the controller, one Prometheus, and Alertmanager (for the PrometheusRule/AlertmanagerConfig objects this chart also renders). Grafana, node-exporter, and kube-state-metrics stay off: a scrape target for the customer's own dashboards, not a second monitoring stack. The bundled Prometheus's ServiceAccount is pinned to a literal name (simplyblock-prometheus-operator) rather than left to kube-prometheus-stack's own release-derived default, so prometheus.serviceAccount can name it without predicting it — the metrics-scraper trust that used to need a manual `kubectl get prometheus ... serviceAccountName` lookup is wired by default now. Its prometheusSpec also turns off every selector's NilUsesHelmValues, which otherwise restricts discovery to objects carrying a release label this chart's own ServiceMonitor/PodMonitor/ScrapeConfig/ PrometheusRule objects don't set. To scrape with a prometheus-operator the customer already runs instead, every component kube-prometheus-stack renders has to be turned off explicitly (values.yaml documents the full list — cluster-component scrapers and defaultRules are separate toggles that don't follow prometheusOperator.enabled/prometheus.enabled, discovered by testing each override combination against `helm template` until nothing from the dependency rendered). Left on with monitoring.coreos.com CRDs already present from elsewhere, the chart now fails fast rather than installing a second prometheus-operator: a release-ownership check (via `lookup`, comparing the existing ServiceMonitor CRD's meta.helm.sh/release-name annotation against this release) tells apart "ours, from import a prior upgrade of this same release" from "somebody else's." The existing "CRD missing" fail-fast checks in prometheus-operator-servicemonitors.yaml and prometheus-operator-alerting.yaml had to change shape too: .Capabilities.APIVersions is captured before this same install's own kube-prometheus-stack dependency would create its CRDs, so on a fresh bundled install the literal capability check would fail an install that was about to supply the CRD itself. They now skip that check entirely whenever bundling is in effect (simplyblock.bundlesPrometheusOperator) and trust Helm's own install ordering instead, applying only to the not-bundling (bring-your-own) path.
…eus subchart removal deleted TestAKeyHoldingDotsIsOneSegment anchored on prometheus.server.extraArgs."storage.tsdb.min-block-duration", which no longer exists now that the bundled Prometheus subchart is gone. Point it at an Ingress annotation key instead, and resync the chart/ copy this module keeps of values.yaml and Chart.yaml.
…already scrapes it managementAPIObjects always applied a Prometheus+Thanos StatefulSet, unconditionally, for every local ControlPlane install -- including one where the chart's own prometheus.enabled path (bundled kube-prometheus-stack, or bring-your-own) already scrapes the management API through a ServiceMonitor. The two ran side by side, duplicating scrapes, with no flag to turn either off. Detect the chart's ServiceMonitor instead of adding a new one, matching the convention internal/prerequisites already uses for cert-manager and the other cluster add-ons: check what's on the cluster before installing, rather than threading a coordination flag through the chart and the CRD. Present, this control plane's own Prometheus, Thanos, and RBAC are left out of the apply. Known gap: flipping prometheus.enabled on for an install that already has its own Prometheus StatefulSet leaves that StatefulSet in place rather than deleting it -- applyAll only ever applies what's in the set, never prunes.
…etheus.enabled off An upgrade from 26.3 runs with prometheus.enabled=false, where the operator still runs simplyblock-prometheus. The migration broke that path three ways: - The management API no longer trusted simplyblock-prometheus, so every scrape got a 401. The operator now always trusts it, then the chart's extras. - Control Center's Prometheus URL defaulted to prometheus-operated, which only exists with the bundled stack. It now follows prometheus.enabled. - Thanos Query lost the sidecar --store, hiding the newest two hours. It is back whenever prometheus.enabled is off. With prometheus.enabled on, the ScrapeConfig used authorization.credentialsFile, which prometheus-operator does not have. It now presents the token of a chart ServiceAccount, simplyblock-metrics-scraper, which the management API trusts. helm-charts/scripts/test-prometheus-values.sh checks both renders and runs in the Helm lint workflow. Claude-Session: https://claude.ai/code/session_011oztNZUjNFk6NYW7UXA1A2
boddumanohar
force-pushed
the
prometheus-operator-migration
branch
from
November 25, 2026 13:44
b6ace33 to
f060523
Compare
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.
So far we rely on a prometheus helm chart for scraping. This PR replaces that with the prometheus operator, which makes it easier to scrape dynamically generated entities, like the SPDK pods. When using the operator, CRs are created to monitor specific components. This PR introduces
{Service,Pod}Monitors to scrape all of our components. Additionally, since the operator has ownership of the AlertManager, the alerts are configured to use that as well.prometheus.enabled=trueis self-contained: this chart now bundleskube-prometheus-stackas a dependency on that same flag, so nothing has to be installed beforehand.To scrape with a prometheus-operator the customer already runs instead, turn the bundled one off and point
prometheus.serviceAccountat the existing Prometheus's own ServiceAccount (webappapi does a TokenReview onevery scrape's bearer token, so it has to be named here or every scrape gets a 401):