Skip to content

Helm: hash only the config data in checksum/* pod annotations - #16571

Merged
56quarters merged 3 commits into
grafana:mainfrom
DrFaust92:helm-checksum-config-data
Sep 15, 2026
Merged

56quarters merged 3 commits into
grafana:mainfrom
DrFaust92:helm-checksum-config-data

Conversation

@DrFaust92

@DrFaust92 DrFaust92 commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Stops helm upgrade from restarting every Mimir pod when only the chart version changed. Two things caused it, and both are fixed here:

  • checksum/config and checksum/alertmanager-fallback-config hashed the entire rendered ConfigMap or Secret, whose metadata.labels include helm.sh/chart. A new mimir.configMapOrSecretContentHash helper hashes only the data section, and is used in mimir.podAnnotations, both alertmanager workloads and the gateway deployment.
  • mimir.podLabels set helm.sh/chart directly, so the chart version was part of every pod template regardless of the annotations. That line is gone; the label stays on the objects themselves, where it is still visible.

Verified with ci/test-oss-values.yaml: rendering against a bumped chart version now leaves all 20 pod templates byte-identical, where previously 18 of them changed. Changing mimir.structuredConfig still moves the checksums and rolls the pods, as before.

Adopting this release recomputes the annotations once, so the pods roll a single time on that specific upgrade — called out in the changelog.

The same approach is used by the loki chart (loki.configMapOrSecretContentHash) and was recently adopted by argo-cd (argoproj/argo-helm#4044) and prometheus-node-exporter (prometheus-community/helm-charts#7264).

The golden records are unaffected: build.sh strips both the checksum/* and helm.sh/chart lines from the generated manifests.

Which issue(s) this PR fixes or relates to

n/a

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]. If changelog entry is not needed, please add the changelog-not-needed label to the PR.
  • about-versioning.md updated with experimental features.

@DrFaust92
DrFaust92 requested a review from a team as a code owner September 11, 2026 22:14
@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Signed commits report

All 3 commits between main and helm-checksum-config-data have verified signatures. ✅

@narqo

narqo commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

The changes look good to me, thank you.

Commits must have verified signatures.

@DrFaust92 could upload the public key, associated with the key, that you'd used to sign the commit to your github account. As the CI bot mentioned above, all repositories in the "grafana" org now require commits to be signed and verified by github.

The checksum/config and checksum/alertmanager-fallback-config annotations
hashed the entire rendered ConfigMap, whose metadata.labels include
helm.sh/chart. That value changes on every chart version bump, so every Mimir
pod was restarted on upgrade even when the configuration was unchanged.

Add a mimir.configMapOrSecretContentHash helper that hashes only the data
section, and use it for both annotations. A pure version bump no longer changes
the checksums, while any real config change still restarts the pods.

The golden records are unaffected: build.sh strips both checksum lines from the
generated manifests.

Signed-off-by: Ilia Lazebnik <ilia.lazebnik@gmail.com>
Signed-off-by: Ilia Lazebnik <ilia.lazebnik@gmail.com>
mimir.podLabels set helm.sh/chart, so the chart version was part of every pod
template and a version bump recreated every pod on upgrade, even with the
checksum annotations fixed. The label stays on the objects themselves.

Signed-off-by: Ilia Lazebnik <ilia.lazebnik@gmail.com>
@DrFaust92
DrFaust92 force-pushed the helm-checksum-config-data branch from 1709230 to 7e50503 Compare September 15, 2026 02:03
@56quarters
56quarters merged commit 1e62656 into grafana:main Sep 15, 2026
94 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants