Skip to content

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

Open
DrFaust92 wants to merge 4 commits into
apache:mainfrom
DrFaust92:helm-checksum-config-data
Open

DrFaust92 wants to merge 4 commits into
apache:mainfrom
DrFaust92:helm-checksum-config-data

Conversation

@DrFaust92

Copy link
Copy Markdown
Contributor

The checksum/* pod annotations hash the entire rendered ConfigMap or Secret, and the manifest's metadata.labels include helm.sh/chart. That value changes on every chart version bump, so every Airflow component is restarted on helm upgrade even when no configuration has changed.

This adds an airflow.configMapOrSecretContentHash helper that hashes only the data/stringData sections, and uses it for all 37 checksum/* annotations across the api-server, scheduler, dag-processor, triggerer, worker, flower, statsd, otel-collector and pgbouncer templates.

Rendering the chart at 2.0.0 against a bumped version with identical values is now byte-identical, while changing config.core.parallelism still moves checksum/airflow-config. The full helm test suite passes (2155 tests).

The same fix was recently made in the argo-cd chart (argoproj/argo-helm#4044); the loki chart uses the same data-only hashing.

Unrelated, but found while testing: checksum/jwt-secret is unstable on every render, and even differs between two pods in the same render, because chart/templates/secrets/jwt-secret.yaml defaults to randAlphaNum 128 and each include re-evaluates it. With jwtSecret unset those pods restart on every upgrade regardless of this change. Happy to open a separate issue or PR for that.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Opus 5 (Claude Code)

Generated-by: Claude Opus 5 (Claude Code) following the guidelines

The checksum/* annotations hashed the entire rendered ConfigMap or Secret,
whose metadata.labels include helm.sh/chart. That value changes on every chart
version bump, so every Airflow component was restarted on upgrade even when no
configuration had changed.

Add an airflow.configMapOrSecretContentHash helper that hashes only the data
and stringData sections, and use it for all 37 checksum/* annotations. A pure
chart version bump no longer changes the checksums, while any real config
change still restarts the pods.
Both were missing from this PR.

The test pins the contract in two directions: a label added through the labels
value, which lands in the same metadata.labels block as chart: airflow-<version>,
must not move any checksum, and a real config change must still move
checksum/airflow-config. Reverting the fix in one deployment fails the first
assertion.

The chart version itself is not settable through values, so an object label
stands in for it.

Signed-off-by: Ilia Lazebnik <[email protected]>
@DrFaust92
DrFaust92 force-pushed the helm-checksum-config-data branch from 58276f3 to c8f5704 Compare October 23, 2026 03:10
@DrFaust92

Copy link
Copy Markdown
Contributor Author

Rebased onto current main — the branch was 1358 commits behind, now 0. Clean rebase, no conflicts, and I checked that none of those commits added a new checksum/* annotation using the old whole-manifest form (the only sha256sum left in chart/templates is inside the helper).

Also added the two things this PR was missing:

Newsfragment — chart/newsfragments/73016.bugfix.rst.

A regression test — chart/tests/helm_tests/airflow_aux/test_config_checksums.py, pinning the contract in both directions:

  • A label added through the labels value must not move any checksum. That label lands in the same metadata.labels block as chart: "airflow-2.0.0", so it stands in for the chart version, which isn't settable through values.
  • checksum/airflow-config must still move on a real config change (config.core.parallelism).

I verified it's a real guard rather than assuming. Reverting the fix in one deployment fails the first assertion, and the mechanism is visible directly:

with the fix:     base  da95149d…   +label  da95149d…   (unchanged)
without the fix:  base  93d378bc…   +label  f6effe24…   (moves)

One thing worth recording for anyone verifying this by hand: jwtSecret and the metadata connection password are generated when not supplied, so two renders of the same chart differ for reasons unrelated to this change. The test pins both. With them pinned, all 10 checksum/* annotations are stable across a chart version bump.

helm_tests/airflow_aux passes in full: 793 tests.

check-newsfragments-are-valid requires exactly one line for every type
except significant, and this one had a summary plus a body paragraph.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Comment thread chart/newsfragments/73016.bugfix.rst Outdated
@@ -0,0 +1 @@
Hash only ``data`` and ``stringData`` in the ``checksum/*`` pod annotations, instead of each rendered ConfigMap and Secret in full, so that ``helm.sh/chart`` in their labels no longer moves the checksums and restarts every component on a chart version bump whose configuration is unchanged

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DrFaust92 DrFaust92 Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in e6e4e67

Comment thread chart/templates/_helpers.yaml Outdated
Comment on lines +1224 to +1226
Compute a ConfigMap or Secret checksum from its data only, for the checksum/* pod annotations.
The full manifest carries the helm.sh/chart label, which changes on every chart version bump and
would restart every Airflow component on upgrade even when no configuration changed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Compute a ConfigMap or Secret checksum from its data only, for the checksum/* pod annotations.
The full manifest carries the helm.sh/chart label, which changes on every chart version bump and
would restart every Airflow component on upgrade even when no configuration changed.
Compute a ConfigMap or Secret checksum from its data only, for the checksum/* pod annotations.
The full manifest carries labels, which may change on every chart deployment and
would restart every Airflow component on upgrade even when no configuration changes.

@DrFaust92 DrFaust92 Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in e6e4e67

Comment on lines +21 to +29
# The checksum/* annotations exist so that a configuration change restarts the component that
# reads it. Hashing the whole rendered manifest also pulled in metadata.labels, which carry
# helm.sh/chart, so the checksums moved on a chart version bump and every component restarted
# even though nothing it reads had changed.

# A label added through the `labels` value lands in the same metadata.labels block as
# chart: "airflow-<version>", so it stands in for the chart version, which is not settable
# through values.
#

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# The checksum/* annotations exist so that a configuration change restarts the component that
# reads it. Hashing the whole rendered manifest also pulled in metadata.labels, which carry
# helm.sh/chart, so the checksums moved on a chart version bump and every component restarted
# even though nothing it reads had changed.
# A label added through the `labels` value lands in the same metadata.labels block as
# chart: "airflow-<version>", so it stands in for the chart version, which is not settable
# through values.
#

I think it is pretty natural to reload only on a config change. We do not rather need a justification for this change living in the code.

@DrFaust92 DrFaust92 Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in e6e4e67

@Miretpl Miretpl added this to the Airflow Helm Chart 2.0.0 milestone Nov 14, 2026
@DrFaust92
DrFaust92 force-pushed the helm-checksum-config-data branch from 7938649 to e6e4e67 Compare November 22, 2026 13:00

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:helm-chart Airflow Helm Chart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants