This is an automated email from the ASF dual-hosted git repository.
Miretpl pushed a commit to branch chart/v1-2x-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/chart/v1-2x-test by this push:
new 5473154381c [chart/v1-2x-test] Fix StatsD not restarting when
overrideMappings or cache.ttl changes (#72633) (#73048)
5473154381c is described below
commit 5473154381c39cdb523cbb1c3351fde8f7843072
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Sep 22 11:51:15 2026 +0200
[chart/v1-2x-test] Fix StatsD not restarting when overrideMappings or
cache.ttl changes (#72633) (#73048)
* Fix StatsD not restarting when overrideMappings or cache.ttl changes
The checksum annotation that rolls the StatsD pod was only rendered when
extraMappings or podAnnotations was set, so changing overrideMappings or
cache.ttl updated the ConfigMap without restarting the pod and the
exporter silently kept the old mappings.
The checksum is also narrowed to the ConfigMap data so that chart version
bumps and other metadata-only changes no longer restart StatsD.
* Hash the whole StatsD ConfigMap document for the rollout checksum
Narrowing the checksum to the ConfigMap's .data made StatsD the only
component in the chart whose pods do not roll on a chart version bump.
Review preferred keeping the same full-document hash every other
component uses: a restart of the stateless StatsD exporter on upgrade
is cheap, and a change we would want to roll out for but did not
anticipate is not.
* Keep the podAnnotations block in its original form
The if-to-with rewrite was a cosmetic change unrelated to the rollout fix
and was flagged as unnecessary in review.
---------
(cherry picked from commit 81b93db4a2f6da3d4e56a337f0f0b84fb2f1b029)
Co-authored-by: Y-C <[email protected]>
Co-authored-by: Eason09053360
<[email protected]>
Co-authored-by: Przemysław Mirowski
<[email protected]>
---
chart/templates/statsd/statsd-deployment.yaml | 2 --
helm-tests/tests/helm_tests/other/test_statsd.py | 23 +++++++++++++++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/chart/templates/statsd/statsd-deployment.yaml
b/chart/templates/statsd/statsd-deployment.yaml
index e5aabe4b819..769946c97b5 100644
--- a/chart/templates/statsd/statsd-deployment.yaml
+++ b/chart/templates/statsd/statsd-deployment.yaml
@@ -64,13 +64,11 @@ spec:
{{- if or .Values.labels .Values.statsd.labels }}
{{- mustMerge .Values.statsd.labels .Values.labels | toYaml |
nindent 8 }}
{{- end }}
- {{- if or .Values.statsd.extraMappings .Values.statsd.podAnnotations }}
annotations:
checksum/statsd-config: {{ include (print $.Template.BasePath
"/configmaps/statsd-configmap.yaml") . | sha256sum }}
{{- if .Values.statsd.podAnnotations }}
{{- tpl (toYaml .Values.statsd.podAnnotations) . | nindent 8 }}
{{- end }}
- {{- end }}
spec:
{{- if .Values.statsd.priorityClassName }}
priorityClassName: {{ .Values.statsd.priorityClassName }}
diff --git a/helm-tests/tests/helm_tests/other/test_statsd.py
b/helm-tests/tests/helm_tests/other/test_statsd.py
index 6f45d9cd4ec..d63fceb7acf 100644
--- a/helm-tests/tests/helm_tests/other/test_statsd.py
+++ b/helm-tests/tests/helm_tests/other/test_statsd.py
@@ -377,6 +377,29 @@ class TestStatsd:
jmespath.search("spec.template.metadata.annotations",
docs[0])["test_pod_annotation"]
== "test_pod_annotation_value"
)
+ assert "checksum/statsd-config" in
jmespath.search("spec.template.metadata.annotations", docs[0])
+
+ @pytest.mark.parametrize(
+ "statsd_values",
+ [
+ pytest.param(
+ {"overrideMappings": [{"match": "foo.*", "name": "foo",
"match_type": "regex"}]},
+ id="overrideMappings",
+ ),
+ pytest.param({"cache": {"ttl": "10m"}}, id="cache-ttl"),
+ ],
+ )
+ def test_configmap_checksum_should_change_with_configmap_data(self,
statsd_values):
+ def get_checksum(values):
+ docs = render_chart(
+ values={"statsd": {"enabled": True, **values}},
+ show_only=["templates/statsd/statsd-deployment.yaml"],
+ )
+ annotations =
jmespath.search("spec.template.metadata.annotations", docs[0]) or {}
+ assert "checksum/statsd-config" in annotations
+ return annotations["checksum/statsd-config"]
+
+ assert get_checksum(statsd_values) != get_checksum({})
def test_should_add_custom_env_variables(self):
env1 = {"name": "TEST_ENV_1", "value": "test_env_1"}