This is an automated email from the ASF dual-hosted git repository.
jscheffl 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 1f7c7f11fc3 [chart/v1-2x-test] Add
workers.celery.topologySpreadConstraints &
workers.kubernetes.topologySpreadConstraints (#64980) (#65055)
1f7c7f11fc3 is described below
commit 1f7c7f11fc3845e0d6a9fa08424d33f94e261124
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Apr 11 13:32:19 2026 +0200
[chart/v1-2x-test] Add workers.celery.topologySpreadConstraints &
workers.kubernetes.topologySpreadConstraints (#64980) (#65055)
* Add workers.celery.topologySpreadConstraints &
workers.kubernetes.topologySpreadConstraints
* Add newsfragment
(cherry picked from commit 511af0a7dd559063c82800fb21b56e4f1c008316)
Co-authored-by: Przemysław Mirowski
<[email protected]>
---
chart/files/pod-template-file.kubernetes-helm-yaml | 2 +-
chart/newsfragments/64980.significant.rst | 1 +
chart/templates/NOTES.txt | 8 +++
chart/values.schema.json | 20 ++++++-
chart/values.yaml | 8 +++
.../airflow_aux/test_pod_template_file.py | 45 +++++++++++++--
.../tests/helm_tests/airflow_core/test_worker.py | 64 ++++++++++++++++++----
.../helm_tests/airflow_core/test_worker_sets.py | 26 +++++++++
8 files changed, 157 insertions(+), 17 deletions(-)
diff --git a/chart/files/pod-template-file.kubernetes-helm-yaml
b/chart/files/pod-template-file.kubernetes-helm-yaml
index 40aabae1703..66d9d7720f8 100644
--- a/chart/files/pod-template-file.kubernetes-helm-yaml
+++ b/chart/files/pod-template-file.kubernetes-helm-yaml
@@ -20,7 +20,7 @@
{{- $nodeSelector := or .Values.workers.kubernetes.nodeSelector
.Values.workers.nodeSelector .Values.nodeSelector }}
{{- $affinity := or .Values.workers.kubernetes.affinity
.Values.workers.affinity .Values.affinity }}
{{- $tolerations := or .Values.workers.kubernetes.tolerations
.Values.workers.tolerations .Values.tolerations }}
-{{- $topologySpreadConstraints := or .Values.workers.topologySpreadConstraints
.Values.topologySpreadConstraints }}
+{{- $topologySpreadConstraints := or
.Values.workers.kubernetes.topologySpreadConstraints
.Values.workers.topologySpreadConstraints .Values.topologySpreadConstraints }}
{{- $securityContext := include "airflowPodSecurityContext" (list
.Values.workers.kubernetes .Values.workers .Values) }}
{{- $containerSecurityContextKerberosSidecar := include
"containerSecurityContext" (list .Values.workers.kubernetes.kerberosSidecar
.Values.workers.kerberosSidecar .Values) }}
{{- $containerLifecycleHooksKerberosSidecar := or
.Values.workers.kubernetes.kerberosSidecar.containerLifecycleHooks
.Values.workers.kerberosSidecar.containerLifecycleHooks
.Values.containerLifecycleHooks }}
diff --git a/chart/newsfragments/64980.significant.rst
b/chart/newsfragments/64980.significant.rst
new file mode 100644
index 00000000000..1fd365a31d0
--- /dev/null
+++ b/chart/newsfragments/64980.significant.rst
@@ -0,0 +1 @@
+``workers.topologySpreadConstraints`` field is now deprecated in favor of
``workers.celery.topologySpreadConstraints`` and
``workers.kubernetes.topologySpreadConstraints``. Please update your
configuration accordingly.
diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt
index bd92092a2d2..5273e167bad 100644
--- a/chart/templates/NOTES.txt
+++ b/chart/templates/NOTES.txt
@@ -749,6 +749,14 @@ DEPRECATION WARNING:
{{- end }}
+{{- if not (empty .Values.workers.topologySpreadConstraints) }}
+
+ DEPRECATION WARNING:
+ `workers.topologySpreadConstraints` has been renamed to
`workers.celery.topologySpreadConstraints`/`workers.kubernetes.topologySpreadConstraints`.
+ Please change your values as support for the old name will be dropped in a
future release.
+
+{{- end }}
+
{{- if not (empty .Values.workers.nodeSelector) }}
DEPRECATION WARNING:
diff --git a/chart/values.schema.json b/chart/values.schema.json
index c7a92ce959d..404a90e2649 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -2372,7 +2372,7 @@
}
},
"topologySpreadConstraints": {
- "description": "Specify topology spread constraints for
Airflow Celery worker pods and pods created with pod-template-file.",
+ "description": "Specify topology spread constraints for
Airflow Celery worker pods and pods created with pod-template-file (deprecated,
use ``workers.celery.topologySpreadConstraints`` and/or
``workers.kubernetes.topologySpreadConstraints`` instead).",
"type": "array",
"default": [],
"items": {
@@ -3451,6 +3451,15 @@
"$ref":
"#/definitions/io.k8s.api.core.v1.Toleration"
}
},
+ "topologySpreadConstraints": {
+ "description": "Specify topology spread
constraints for Airflow Celery worker pods.",
+ "type": "array",
+ "default": [],
+ "items": {
+ "type": "object",
+ "$ref":
"#/definitions/io.k8s.api.core.v1.TopologySpreadConstraint"
+ }
+ },
"hostAliases": {
"description": "Specify HostAliases for Airflow
Celery worker pods.",
"items": {
@@ -3966,6 +3975,15 @@
"$ref":
"#/definitions/io.k8s.api.core.v1.Toleration"
}
},
+ "topologySpreadConstraints": {
+ "description": "Specify topology spread
constraints for pods created with pod-template-file.",
+ "type": "array",
+ "default": [],
+ "items": {
+ "type": "object",
+ "$ref":
"#/definitions/io.k8s.api.core.v1.TopologySpreadConstraint"
+ }
+ },
"hostAliases": {
"description": "Specify HostAliases for pods
created with pod-template-file.",
"items": {
diff --git a/chart/values.yaml b/chart/values.yaml
index 5d20fa0bac1..3096e73b2b8 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -1108,6 +1108,10 @@ workers:
# (deprecated, use `workers.celery.tolerations` and/or
`workers.kubernetes.tolerations` instead)
tolerations: []
+ # (deprecated, use
+ # `workers.celery.topologySpreadConstraints` and/or
+ # `workers.kubernetes.topologySpreadConstraints`
+ # instead)
topologySpreadConstraints: []
# hostAliases to use in Airflow Celery worker pods and pods created with
pod-template-file
@@ -1496,6 +1500,8 @@ workers:
tolerations: []
+ topologySpreadConstraints: []
+
# hostAliases to use in Airflow Celery worker pods
# See:
#
https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/
@@ -1666,6 +1672,8 @@ workers:
tolerations: []
+ topologySpreadConstraints: []
+
# hostAliases to use in pods created with pod-template-file
# See:
#
https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/
diff --git a/helm-tests/tests/helm_tests/airflow_aux/test_pod_template_file.py
b/helm-tests/tests/helm_tests/airflow_aux/test_pod_template_file.py
index 6fbb87762e0..b0030307251 100644
--- a/helm-tests/tests/helm_tests/airflow_aux/test_pod_template_file.py
+++ b/helm-tests/tests/helm_tests/airflow_aux/test_pod_template_file.py
@@ -594,11 +594,41 @@ class TestPodTemplateFile:
{"key": "dynamic-pods", "operator": "Equal", "value": "true",
"effect": "NoSchedule"}
]
- def test_workers_topology_spread_constraints(self):
- docs = render_chart(
- values={
- "executor": "KubernetesExecutor",
- "workers": {
+ @pytest.mark.parametrize(
+ "workers_values",
+ [
+ {
+ "topologySpreadConstraints": [
+ {
+ "maxSkew": 1,
+ "topologyKey": "foo",
+ "whenUnsatisfiable": "ScheduleAnyway",
+ "labelSelector": {"matchLabels": {"tier": "airflow"}},
+ }
+ ],
+ },
+ {
+ "kubernetes": {
+ "topologySpreadConstraints": [
+ {
+ "maxSkew": 1,
+ "topologyKey": "foo",
+ "whenUnsatisfiable": "ScheduleAnyway",
+ "labelSelector": {"matchLabels": {"tier":
"airflow"}},
+ }
+ ],
+ }
+ },
+ {
+ "topologySpreadConstraints": [
+ {
+ "maxSkew": 1,
+ "topologyKey": "not-me",
+ "whenUnsatisfiable": "ScheduleAnyway",
+ "labelSelector": {"matchLabels": {"tier": "airflow"}},
+ }
+ ],
+ "kubernetes": {
"topologySpreadConstraints": [
{
"maxSkew": 1,
@@ -609,6 +639,11 @@ class TestPodTemplateFile:
],
},
},
+ ],
+ )
+ def test_workers_topology_spread_constraints(self, workers_values):
+ docs = render_chart(
+ values={"executor": "KubernetesExecutor", "workers":
workers_values},
show_only=["templates/pod-template-file.yaml"],
chart_dir=self.temp_chart_dir,
)
diff --git a/helm-tests/tests/helm_tests/airflow_core/test_worker.py
b/helm-tests/tests/helm_tests/airflow_core/test_worker.py
index 5eb4b07733b..6c2a5a9ab40 100644
--- a/helm-tests/tests/helm_tests/airflow_core/test_worker.py
+++ b/helm-tests/tests/helm_tests/airflow_core/test_worker.py
@@ -706,8 +706,60 @@ class TestWorker:
{"key": "dynamic-pods", "operator": "Equal", "value": "true",
"effect": "NoSchedule"}
]
- def test_topology_spread_constraints(self):
- expected_topology_spread_constraints = [
+ @pytest.mark.parametrize(
+ "workers_values",
+ [
+ {
+ "topologySpreadConstraints": [
+ {
+ "maxSkew": 1,
+ "topologyKey": "foo",
+ "whenUnsatisfiable": "ScheduleAnyway",
+ "labelSelector": {"matchLabels": {"tier": "airflow"}},
+ }
+ ]
+ },
+ {
+ "celery": {
+ "topologySpreadConstraints": [
+ {
+ "maxSkew": 1,
+ "topologyKey": "foo",
+ "whenUnsatisfiable": "ScheduleAnyway",
+ "labelSelector": {"matchLabels": {"tier":
"airflow"}},
+ }
+ ]
+ }
+ },
+ {
+ "topologySpreadConstraints": [
+ {
+ "maxSkew": 2,
+ "topologyKey": "not-me",
+ "whenUnsatisfiable": "ScheduleAnyway",
+ "labelSelector": {"matchLabels": {"airflow": "test"}},
+ }
+ ],
+ "celery": {
+ "topologySpreadConstraints": [
+ {
+ "maxSkew": 1,
+ "topologyKey": "foo",
+ "whenUnsatisfiable": "ScheduleAnyway",
+ "labelSelector": {"matchLabels": {"tier":
"airflow"}},
+ }
+ ]
+ },
+ },
+ ],
+ )
+ def test_topology_spread_constraints(self, workers_values):
+ docs = render_chart(
+ values={"workers": workers_values},
+ show_only=["templates/workers/worker-deployment.yaml"],
+ )
+
+ assert jmespath.search("spec.template.spec.topologySpreadConstraints",
docs[0]) == [
{
"maxSkew": 1,
"topologyKey": "foo",
@@ -715,14 +767,6 @@ class TestWorker:
"labelSelector": {"matchLabels": {"tier": "airflow"}},
}
]
- docs = render_chart(
- values={"workers": {"topologySpreadConstraints":
expected_topology_spread_constraints}},
- show_only=["templates/workers/worker-deployment.yaml"],
- )
-
- assert expected_topology_spread_constraints == jmespath.search(
- "spec.template.spec.topologySpreadConstraints", docs[0]
- )
@pytest.mark.parametrize(
"workers_values",
diff --git a/helm-tests/tests/helm_tests/airflow_core/test_worker_sets.py
b/helm-tests/tests/helm_tests/airflow_core/test_worker_sets.py
index 28fb480b9e7..50efb69dff1 100644
--- a/helm-tests/tests/helm_tests/airflow_core/test_worker_sets.py
+++ b/helm-tests/tests/helm_tests/airflow_core/test_worker_sets.py
@@ -2998,6 +2998,32 @@ class TestWorkerSets:
],
},
},
+ {
+ "celery": {
+ "enableDefault": False,
+ "topologySpreadConstraints": [
+ {
+ "maxSkew": 1,
+ "topologyKey": "not-me",
+ "whenUnsatisfiable": "ScheduleAnyway",
+ "labelSelector": {"matchLabels": {"tier":
"airflow"}},
+ }
+ ],
+ "sets": [
+ {
+ "name": "set1",
+ "topologySpreadConstraints": [
+ {
+ "maxSkew": 1,
+ "topologyKey": "foo",
+ "whenUnsatisfiable": "ScheduleAnyway",
+ "labelSelector": {"matchLabels": {"tier":
"airflow"}},
+ }
+ ],
+ }
+ ],
+ },
+ },
],
)
def test_overwrite_topology_spread_constraints(self, workers_values):