This is an automated email from the ASF dual-hosted git repository.

jscheffl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new d5cbfe52e78 Add workers.celery.tolerations & 
workers.kubernetes.tolerations (#64976)
d5cbfe52e78 is described below

commit d5cbfe52e78b3dcae58fe6262926ba285be2d947
Author: Przemysław Mirowski <[email protected]>
AuthorDate: Sat Apr 11 09:52:09 2026 +0200

    Add workers.celery.tolerations & workers.kubernetes.tolerations (#64976)
    
    * Add workers.celery.tolerations & workers.kubernetes.tolerations
    
    * Add newsfragment
---
 chart/files/pod-template-file.kubernetes-helm-yaml |  2 +-
 chart/newsfragments/64976.significant.rst          |  1 +
 chart/templates/NOTES.txt                          |  8 ++++++
 chart/values.schema.json                           | 20 ++++++++++++-
 chart/values.yaml                                  |  6 ++++
 .../airflow_aux/test_pod_template_file.py          | 33 ++++++++++++++++++----
 .../tests/helm_tests/airflow_core/test_worker.py   | 33 ++++++++++++++++++----
 .../helm_tests/airflow_core/test_worker_sets.py    | 21 ++++++++++++++
 8 files changed, 110 insertions(+), 14 deletions(-)

diff --git a/chart/files/pod-template-file.kubernetes-helm-yaml 
b/chart/files/pod-template-file.kubernetes-helm-yaml
index 23fe2fc1421..40aabae1703 100644
--- a/chart/files/pod-template-file.kubernetes-helm-yaml
+++ b/chart/files/pod-template-file.kubernetes-helm-yaml
@@ -19,7 +19,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.tolerations .Values.tolerations }}
+{{- $tolerations := or .Values.workers.kubernetes.tolerations 
.Values.workers.tolerations .Values.tolerations }}
 {{- $topologySpreadConstraints := or .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) }}
diff --git a/chart/newsfragments/64976.significant.rst 
b/chart/newsfragments/64976.significant.rst
new file mode 100644
index 00000000000..2a43592ae27
--- /dev/null
+++ b/chart/newsfragments/64976.significant.rst
@@ -0,0 +1 @@
+``workers.tolerations`` field is now deprecated in favor of 
``workers.celery.tolerations`` and ``workers.kubernetes.tolerations``. Please 
update your configuration accordingly.
diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt
index 654ffc527e2..bd92092a2d2 100644
--- a/chart/templates/NOTES.txt
+++ b/chart/templates/NOTES.txt
@@ -741,6 +741,14 @@ DEPRECATION WARNING:
 
 {{- end }}
 
+{{- if not (empty .Values.workers.tolerations) }}
+
+ DEPRECATION WARNING:
+    `workers.tolerations` has been renamed to 
`workers.celery.tolerations`/`workers.kubernetes.tolerations`.
+    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 475fd97eb8d..555dc09410e 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -2363,7 +2363,7 @@
                     "$ref": "#/definitions/io.k8s.api.core.v1.Affinity"
                 },
                 "tolerations": {
-                    "description": "Specify Tolerations for Airflow Celery 
worker pods and pods created with pod-template-file.",
+                    "description": "Specify Tolerations for Airflow Celery 
worker pods and pods created with pod-template-file (deprecated, use 
``workers.celery.tolerations`` and/or ``workers.kubernetes.tolerations`` 
instead).",
                     "type": "array",
                     "default": [],
                     "items": {
@@ -3442,6 +3442,15 @@
                             "default": {},
                             "$ref": "#/definitions/io.k8s.api.core.v1.Affinity"
                         },
+                        "tolerations": {
+                            "description": "Specify Tolerations for Airflow 
Celery worker pods.",
+                            "type": "array",
+                            "default": [],
+                            "items": {
+                                "type": "object",
+                                "$ref": 
"#/definitions/io.k8s.api.core.v1.Toleration"
+                            }
+                        },
                         "hostAliases": {
                             "description": "Specify HostAliases for Airflow 
Celery worker pods.",
                             "items": {
@@ -3948,6 +3957,15 @@
                             "default": {},
                             "$ref": "#/definitions/io.k8s.api.core.v1.Affinity"
                         },
+                        "tolerations": {
+                            "description": "Specify Tolerations for pods 
created with pod-template-file.",
+                            "type": "array",
+                            "default": [],
+                            "items": {
+                                "type": "object",
+                                "$ref": 
"#/definitions/io.k8s.api.core.v1.Toleration"
+                            }
+                        },
                         "hostAliases": {
                             "description": "Specify HostAliases for pods 
created with pod-template-file.",
                             "items": {
diff --git a/chart/values.yaml b/chart/values.yaml
index 9db202b4a65..82550521314 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -1105,7 +1105,9 @@ workers:
   #        topologyKey: kubernetes.io/hostname
   #      weight: 100
 
+  # (deprecated, use `workers.celery.tolerations` and/or 
`workers.kubernetes.tolerations` instead)
   tolerations: []
+
   topologySpreadConstraints: []
 
   # hostAliases to use in Airflow Celery worker pods and pods created with 
pod-template-file
@@ -1492,6 +1494,8 @@ workers:
     #        topologyKey: kubernetes.io/hostname
     #      weight: 100
 
+    tolerations: []
+
     # 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/
@@ -1660,6 +1664,8 @@ workers:
 
     affinity: {}
 
+    tolerations: []
+
     # 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 f903c56b04a..6fbb87762e0 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
@@ -554,16 +554,37 @@ class TestPodTemplateFile:
             }
         }
 
-    def test_workers_tolerations(self):
-        docs = render_chart(
-            values={
-                "executor": "KubernetesExecutor",
-                "workers": {
+    @pytest.mark.parametrize(
+        "workers_values",
+        [
+            {
+                "tolerations": [
+                    {"key": "dynamic-pods", "operator": "Equal", "value": 
"true", "effect": "NoSchedule"}
+                ],
+            },
+            {
+                "kubernetes": {
                     "tolerations": [
                         {"key": "dynamic-pods", "operator": "Equal", "value": 
"true", "effect": "NoSchedule"}
-                    ],
+                    ]
+                },
+            },
+            {
+                "tolerations": [{"key": "pods", "operator": "Exists", 
"effect": "PreferNoSchedule"}],
+                "kubernetes": {
+                    "tolerations": [
+                        {"key": "dynamic-pods", "operator": "Equal", "value": 
"true", "effect": "NoSchedule"}
+                    ]
                 },
             },
+        ],
+    )
+    def test_workers_tolerations(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 1db7e103358..5eb4b07733b 100644
--- a/helm-tests/tests/helm_tests/airflow_core/test_worker.py
+++ b/helm-tests/tests/helm_tests/airflow_core/test_worker.py
@@ -667,16 +667,37 @@ class TestWorker:
             }
         }
 
-    def test_tolerations(self):
-        docs = render_chart(
-            values={
-                "executor": "CeleryExecutor",
-                "workers": {
+    @pytest.mark.parametrize(
+        "workers_values",
+        [
+            {
+                "tolerations": [
+                    {"key": "dynamic-pods", "operator": "Equal", "value": 
"true", "effect": "NoSchedule"}
+                ],
+            },
+            {
+                "celery": {
                     "tolerations": [
                         {"key": "dynamic-pods", "operator": "Equal", "value": 
"true", "effect": "NoSchedule"}
-                    ],
+                    ]
                 },
             },
+            {
+                "tolerations": [{"key": "pods", "operator": "Exists", 
"effect": "PreferNoSchedule"}],
+                "celery": {
+                    "tolerations": [
+                        {"key": "dynamic-pods", "operator": "Equal", "value": 
"true", "effect": "NoSchedule"}
+                    ]
+                },
+            },
+        ],
+    )
+    def test_tolerations(self, workers_values):
+        docs = render_chart(
+            values={
+                "executor": "CeleryExecutor",
+                "workers": workers_values,
+            },
             show_only=["templates/workers/worker-deployment.yaml"],
         )
 
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 1d2149f3966..28fb480b9e7 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
@@ -2923,6 +2923,27 @@ class TestWorkerSets:
                     ],
                 },
             },
+            {
+                "celery": {
+                    "enableDefault": False,
+                    "tolerations": [
+                        {"key": "not-me", "operator": "Equal", "value": 
"true", "effect": "NoSchedule"}
+                    ],
+                    "sets": [
+                        {
+                            "name": "set1",
+                            "tolerations": [
+                                {
+                                    "key": "dynamic-pods",
+                                    "operator": "Equal",
+                                    "value": "true",
+                                    "effect": "NoSchedule",
+                                }
+                            ],
+                        }
+                    ],
+                },
+            },
         ],
     )
     def test_overwrite_tolerations(self, workers_values):

Reply via email to