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 fcfa43fdd15 [chart/v1-2x-test] Add workers.celery.podAnnotations & 
workers.kubernetes.podAnnotations (#65027) (#65068)
fcfa43fdd15 is described below

commit fcfa43fdd150141fffe7b672143433e5f2d23d0f
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Apr 11 20:30:48 2026 +0200

    [chart/v1-2x-test] Add workers.celery.podAnnotations & 
workers.kubernetes.podAnnotations (#65027) (#65068)
    
    * Move pod_template annotations tests & add missing test cases
    
    * Add workers.celery.podAnnotations & workers.kubernetes.podAnnotations
    
    * Add newsfragment
    
    * Make pod template tests more robust
    (cherry picked from commit 8a02c43dcb7efd5cb7e9845e38e60c09219d1895)
    
    Co-authored-by: Przemysław Mirowski 
<[email protected]>
---
 chart/files/pod-template-file.kubernetes-helm-yaml |   2 +-
 chart/newsfragments/65027.significant.rst          |   1 +
 chart/templates/NOTES.txt                          |   8 ++
 chart/values.schema.json                           |  18 ++-
 chart/values.yaml                                  |   7 ++
 .../helm_tests/airflow_aux/test_annotations.py     | 133 +++++++++------------
 .../airflow_aux/test_pod_template_file.py          |  67 +++++++++--
 .../tests/helm_tests/airflow_core/test_worker.py   |  96 +++++++++------
 .../helm_tests/airflow_core/test_worker_sets.py    |   7 ++
 9 files changed, 216 insertions(+), 123 deletions(-)

diff --git a/chart/files/pod-template-file.kubernetes-helm-yaml 
b/chart/files/pod-template-file.kubernetes-helm-yaml
index 66d9d7720f8..e7143e61a5b 100644
--- a/chart/files/pod-template-file.kubernetes-helm-yaml
+++ b/chart/files/pod-template-file.kubernetes-helm-yaml
@@ -29,7 +29,7 @@
 {{- $containerSecurityContext := include "containerSecurityContext" (list 
.Values.workers.kubernetes .Values.workers .Values) }}
 {{- $containerLifecycleHooks := or 
.Values.workers.kubernetes.containerLifecycleHooks 
.Values.workers.containerLifecycleHooks .Values.containerLifecycleHooks }}
 {{- $safeToEvict := dict "cluster-autoscaler.kubernetes.io/safe-to-evict" (or 
.Values.workers.kubernetes.safeToEvict (and (not (has 
.Values.workers.kubernetes.safeToEvict (list true false))) 
.Values.workers.safeToEvict) | toString) }}
-{{- $podAnnotations := mergeOverwrite (deepCopy .Values.airflowPodAnnotations) 
$safeToEvict .Values.workers.podAnnotations }}
+{{- $podAnnotations := mergeOverwrite (deepCopy .Values.airflowPodAnnotations) 
$safeToEvict (.Values.workers.kubernetes.podAnnotations | default 
.Values.workers.podAnnotations) }}
 {{- $schedulerName := or .Values.workers.kubernetes.schedulerName 
.Values.workers.schedulerName .Values.schedulerName }}
 apiVersion: v1
 kind: Pod
diff --git a/chart/newsfragments/65027.significant.rst 
b/chart/newsfragments/65027.significant.rst
new file mode 100644
index 00000000000..861f1233988
--- /dev/null
+++ b/chart/newsfragments/65027.significant.rst
@@ -0,0 +1 @@
+``workers.podAnnotations`` field is now deprecated in favor of 
``workers.celery.podAnnotations`` and ``workers.kubernetes.podAnnotations``. 
Please update your configuration accordingly.
diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt
index ae4c13bc8e7..8142ffc1dcc 100644
--- a/chart/templates/NOTES.txt
+++ b/chart/templates/NOTES.txt
@@ -789,6 +789,14 @@ DEPRECATION WARNING:
 
 {{- end }}
 
+{{- if not (empty .Values.workers.podAnnotations) }}
+
+ DEPRECATION WARNING:
+    `workers.podAnnotations` has been renamed to 
`workers.celery.podAnnotations`/`workers.kubernetes.podAnnotations`.
+    Please change your values as support for the old name will be dropped in a 
future release.
+
+{{- end }}
+
 {{- if not (empty .Values.workers.volumeClaimTemplates) }}
 
  DEPRECATION WARNING:
diff --git a/chart/values.schema.json b/chart/values.schema.json
index 6b2a25511af..28e7ee16e89 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -2411,7 +2411,7 @@
                     }
                 },
                 "podAnnotations": {
-                    "description": "Annotations to add to the Airflow Celery 
workers and pods created with pod-template-file (templated).",
+                    "description": "Annotations to add to the Airflow Celery 
workers and pods created with pod-template-file (templated) (deprecated, use 
``workers.celery.podAnnotations`` and/or ``workers.kubernetes.podAnnotations`` 
instead).",
                     "type": "object",
                     "default": {},
                     "additionalProperties": {
@@ -3490,6 +3490,14 @@
                                 "type": "string"
                             }
                         },
+                        "podAnnotations": {
+                            "description": "Annotations to add to the Airflow 
Celery workers (templated).",
+                            "type": "object",
+                            "default": {},
+                            "additionalProperties": {
+                                "type": "string"
+                            }
+                        },
                         "waitForMigrations": {
                             "description": "Configuration of 
wait-for-airflow-migration init container for Airflow Celery workers.",
                             "type": "object",
@@ -4014,6 +4022,14 @@
                                 }
                             ]
                         },
+                        "podAnnotations": {
+                            "description": "Annotations to add to the pods 
created with pod-template-file (templated).",
+                            "type": "object",
+                            "default": {},
+                            "additionalProperties": {
+                                "type": "string"
+                            }
+                        },
                         "schedulerName": {
                             "description": "Specify kube scheduler name for 
pods created with pod-template-file.",
                             "type": [
diff --git a/chart/values.yaml b/chart/values.yaml
index 1552e25e1cb..22d3c44a6fd 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -1131,6 +1131,7 @@ workers:
   annotations: {}
 
   # Pod annotations for the Airflow Celery workers and pods created with 
pod-template-file (templated)
+  # (deprecated, use `workers.celery.podAnnotations` and/or 
`workers.kubernetes.podAnnotations` instead)
   podAnnotations: {}
 
   # Labels specific to Airflow Celery workers objects and pods created with 
pod-template-file
@@ -1517,6 +1518,9 @@ workers:
     # Annotations for the Airflow Celery worker resource
     annotations: {}
 
+    # Pod annotations for the Airflow Celery workers (templated)
+    podAnnotations: {}
+
     # Configuration of wait-for-airflow-migration init container for Airflow 
Celery workers
     waitForMigrations:
       # Whether to create init container to wait for db migrations
@@ -1689,6 +1693,9 @@ workers:
     #   hostnames:
     #   - "test.hostname.two"
 
+    # Pod annotations for the pods created with pod-template-file (templated)
+    podAnnotations: {}
+
     schedulerName: ~
 
 # Airflow scheduler settings
diff --git a/helm-tests/tests/helm_tests/airflow_aux/test_annotations.py 
b/helm-tests/tests/helm_tests/airflow_aux/test_annotations.py
index 2641f922fb1..b10cc00cf38 100644
--- a/helm-tests/tests/helm_tests/airflow_aux/test_annotations.py
+++ b/helm-tests/tests/helm_tests/airflow_aux/test_annotations.py
@@ -18,9 +18,7 @@ from __future__ import annotations
 
 import copy
 
-import jmespath
 import pytest
-import yaml
 from chart_utils.helm_template_generator import render_chart
 
 
@@ -392,39 +390,72 @@ class TestServiceAccountAnnotations:
             {
                 "scheduler": {
                     "podAnnotations": {
-                        "example": "scheduler",
+                        "example": "{{ .Release.Name }}-scheduler",
                     },
                 },
             },
             "templates/scheduler/scheduler-deployment.yaml",
             {
-                "example": "scheduler",
+                "example": "release-name-scheduler",
             },
         ),
         (
             {
                 "apiServer": {
                     "podAnnotations": {
-                        "example": "api-server",
+                        "example": "{{ .Release.Name }}-api-server",
                     },
                 },
             },
             "templates/api-server/api-server-deployment.yaml",
             {
-                "example": "api-server",
+                "example": "release-name-api-server",
             },
         ),
         (
             {
                 "workers": {
                     "podAnnotations": {
-                        "example": "worker",
+                        "example": "{{ .Release.Name }}-worker",
                     },
                 },
             },
             "templates/workers/worker-deployment.yaml",
             {
-                "example": "worker",
+                "example": "release-name-worker",
+            },
+        ),
+        (
+            {
+                "workers": {
+                    "celery": {
+                        "podAnnotations": {
+                            "example": "{{ .Release.Name }}-worker",
+                        },
+                    }
+                },
+            },
+            "templates/workers/worker-deployment.yaml",
+            {
+                "example": "release-name-worker",
+            },
+        ),
+        (
+            {
+                "workers": {
+                    "podAnnotations": {
+                        "test": "test",
+                    },
+                    "celery": {
+                        "podAnnotations": {
+                            "example": "{{ .Release.Name }}-worker",
+                        },
+                    },
+                },
+            },
+            "templates/workers/worker-deployment.yaml",
+            {
+                "example": "release-name-worker",
             },
         ),
         (
@@ -432,26 +463,26 @@ class TestServiceAccountAnnotations:
                 "flower": {
                     "enabled": True,
                     "podAnnotations": {
-                        "example": "flower",
+                        "example": "{{ .Release.Name }}-flower",
                     },
                 },
             },
             "templates/flower/flower-deployment.yaml",
             {
-                "example": "flower",
+                "example": "release-name-flower",
             },
         ),
         (
             {
                 "triggerer": {
                     "podAnnotations": {
-                        "example": "triggerer",
+                        "example": "{{ .Release.Name }}-triggerer",
                     },
                 },
             },
             "templates/triggerer/triggerer-deployment.yaml",
             {
-                "example": "triggerer",
+                "example": "release-name-triggerer",
             },
         ),
         (
@@ -459,13 +490,13 @@ class TestServiceAccountAnnotations:
                 "dagProcessor": {
                     "enabled": True,
                     "podAnnotations": {
-                        "example": "dag-processor",
+                        "example": "{{ .Release.Name }}-dag-processor",
                     },
                 },
             },
             "templates/dag-processor/dag-processor-deployment.yaml",
             {
-                "example": "dag-processor",
+                "example": "release-name-dag-processor",
             },
         ),
         (
@@ -474,13 +505,13 @@ class TestServiceAccountAnnotations:
                 "cleanup": {
                     "enabled": True,
                     "podAnnotations": {
-                        "example": "cleanup",
+                        "example": "{{ .Release.Name }}-cleanup",
                     },
                 },
             },
             "templates/cleanup/cleanup-cronjob.yaml",
             {
-                "example": "cleanup",
+                "example": "release-name-cleanup",
             },
         ),
         (
@@ -488,39 +519,39 @@ class TestServiceAccountAnnotations:
                 "databaseCleanup": {
                     "enabled": True,
                     "podAnnotations": {
-                        "example": "database-cleanup",
+                        "example": "{{ .Release.Name }}-database-cleanup",
                     },
                 }
             },
             "templates/database-cleanup/database-cleanup-cronjob.yaml",
             {
-                "example": "database-cleanup",
+                "example": "release-name-database-cleanup",
             },
         ),
         (
             {
                 "redis": {
                     "podAnnotations": {
-                        "example": "redis",
+                        "example": "{{ .Release.Name }}-redis",
                     },
                 },
             },
             "templates/redis/redis-statefulset.yaml",
             {
-                "example": "redis",
+                "example": "release-name-redis",
             },
         ),
         (
             {
                 "statsd": {
                     "podAnnotations": {
-                        "example": "statsd",
+                        "example": "{{ .Release.Name }}-statsd",
                     },
                 },
             },
             "templates/statsd/statsd-deployment.yaml",
             {
-                "example": "statsd",
+                "example": "release-name-statsd",
             },
         ),
         (
@@ -528,13 +559,13 @@ class TestServiceAccountAnnotations:
                 "pgbouncer": {
                     "enabled": True,
                     "podAnnotations": {
-                        "example": "pgbouncer",
+                        "example": "{{ .Release.Name }}-pgbouncer",
                     },
                 },
             },
             "templates/pgbouncer/pgbouncer-deployment.yaml",
             {
-                "example": "pgbouncer",
+                "example": "release-name-pgbouncer",
             },
         ),
     ],
@@ -583,19 +614,15 @@ class TestPerComponentPodAnnotations:
             assert v == annotations[k]
 
     def test_pod_annotations_are_templated(self, values, show_only, 
expected_annotations):
-        templated_values = copy.deepcopy(values)
-        for val in templated_values.values():
-            if isinstance(val, dict) and "podAnnotations" in val:
-                val["podAnnotations"] = {"release-name": "{{ .Release.Name }}"}
-
         k8s_objects = render_chart(
-            values=templated_values,
+            values=values,
             show_only=[show_only],
         )
 
         assert len(k8s_objects) == 1
         annotations = get_object_annotations(k8s_objects[0])
-        assert annotations["release-name"] == "release-name"
+        assert annotations["example"] == expected_annotations["example"]
+        assert "test" not in annotations
 
     def test_airflow_pod_annotations_are_templated(self, values, show_only, 
expected_annotations):
         templated_values = copy.deepcopy(values)
@@ -645,50 +672,6 @@ class TestRedisAnnotations:
             assert v == obj["metadata"]["annotations"][k]
 
 
-class TestPodTemplateFileAnnotationsTemplating:
-    """Tests that podAnnotations are templated in the pod template file."""
-
-    def test_pod_template_file_annotations_are_templated(self):
-        k8s_objects = render_chart(
-            values={
-                "executor": "KubernetesExecutor",
-                "workers": {
-                    "podAnnotations": {
-                        "release-name": "{{ .Release.Name }}",
-                    },
-                },
-            },
-            show_only=["templates/configmaps/configmap.yaml"],
-        )
-
-        assert len(k8s_objects) == 1
-        pod_template = k8s_objects[0]["data"]["pod_template_file.yaml"]
-        annotations = jmespath.search(
-            "metadata.annotations",
-            yaml.safe_load(pod_template),
-        )
-        assert annotations["release-name"] == "release-name"
-
-    def test_pod_template_file_global_annotations_are_templated(self):
-        k8s_objects = render_chart(
-            values={
-                "executor": "KubernetesExecutor",
-                "airflowPodAnnotations": {
-                    "global-release": "{{ .Release.Name }}",
-                },
-            },
-            show_only=["templates/configmaps/configmap.yaml"],
-        )
-
-        assert len(k8s_objects) == 1
-        pod_template = k8s_objects[0]["data"]["pod_template_file.yaml"]
-        annotations = jmespath.search(
-            "metadata.annotations",
-            yaml.safe_load(pod_template),
-        )
-        assert annotations["global-release"] == "release-name"
-
-
 class TestWebserverPodAnnotationsTemplating:
     """Tests webserver podAnnotations templating (requires airflowVersion < 
3.0.0)."""
 
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 b0030307251..281fb766872 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
@@ -1115,29 +1115,76 @@ class TestPodTemplateFile:
             annotations = 
jmespath.search("spec.template.metadata.annotations", doc)
             assert 
annotations.get("cluster-autoscaler.kubernetes.io/safe-to-evict") == "true"
 
-    def test_workers_pod_annotations(self):
+    def test_global_pod_annotations_templated(self):
         docs = render_chart(
-            values={"workers": {"podAnnotations": {"my_annotation": 
"annotated!"}}},
+            values={"airflowPodAnnotations": {"global": "{{ .Release.Name 
}}"}},
             show_only=["templates/pod-template-file.yaml"],
             chart_dir=self.temp_chart_dir,
         )
-        annotations = jmespath.search("metadata.annotations", docs[0])
-        assert "my_annotation" in annotations
-        assert "annotated!" in annotations["my_annotation"]
 
-    def test_airflow_and_workers_pod_annotations(self):
-        # should give preference to workers.podAnnotations
+        assert jmespath.search("metadata.annotations", docs[0])["global"] == 
"release-name"
+
+    @pytest.mark.parametrize(
+        "workers_values",
+        [
+            {"podAnnotations": {"my_annotation": "{{ .Release.Name }}"}},
+            {"kubernetes": {"podAnnotations": {"my_annotation": "{{ 
.Release.Name }}"}}},
+            {
+                "podAnnotations": {"test": "test"},
+                "kubernetes": {"podAnnotations": {"my_annotation": "{{ 
.Release.Name }}"}},
+            },
+        ],
+    )
+    def test_workers_pod_annotations_templated(self, workers_values):
+        docs = render_chart(
+            values={"workers": workers_values},
+            show_only=["templates/pod-template-file.yaml"],
+            chart_dir=self.temp_chart_dir,
+        )
+
+        assert jmespath.search("metadata.annotations", 
docs[0])["my_annotation"] == "release-name"
+
+    @pytest.mark.parametrize(
+        "workers_values",
+        [
+            {"podAnnotations": {"my_annotation": "workerPodAnnotations"}},
+            {"kubernetes": {"podAnnotations": {"my_annotation": 
"workerPodAnnotations"}}},
+        ],
+    )
+    def test_workers_pod_annotations_override(self, workers_values):
+        # Worker-specific pod annotations should override global 
airflowPodAnnotations,
+        # whether they come from workers.podAnnotations or 
workers.kubernetes.podAnnotations
         docs = render_chart(
             values={
                 "airflowPodAnnotations": {"my_annotation": 
"airflowPodAnnotations"},
-                "workers": {"podAnnotations": {"my_annotation": 
"workerPodAnnotations"}},
+                "workers": workers_values,
+            },
+            show_only=["templates/pod-template-file.yaml"],
+            chart_dir=self.temp_chart_dir,
+        )
+
+        assert jmespath.search("metadata.annotations", 
docs[0])["my_annotation"] == "workerPodAnnotations"
+
+    @pytest.mark.parametrize(
+        "workers_values",
+        [
+            {"podAnnotations": {"local": "workerPodAnnotations"}},
+            {"kubernetes": {"podAnnotations": {"local": 
"workerPodAnnotations"}}},
+        ],
+    )
+    def test_pod_annotations_merge(self, workers_values):
+        docs = render_chart(
+            values={
+                "airflowPodAnnotations": {"global": "airflowPodAnnotations"},
+                "workers": workers_values,
             },
             show_only=["templates/pod-template-file.yaml"],
             chart_dir=self.temp_chart_dir,
         )
+
         annotations = jmespath.search("metadata.annotations", docs[0])
-        assert "my_annotation" in annotations
-        assert "workerPodAnnotations" in annotations["my_annotation"]
+        assert annotations["global"] == "airflowPodAnnotations"
+        assert annotations["local"] == "workerPodAnnotations"
 
     @pytest.mark.parametrize(
         "workers_values",
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 810e56e3967..31fcfef74d3 100644
--- a/helm-tests/tests/helm_tests/airflow_core/test_worker.py
+++ b/helm-tests/tests/helm_tests/airflow_core/test_worker.py
@@ -1514,7 +1514,7 @@ class TestWorker:
             (
                 {},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
+                    "celery": {"podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"}},
                     "safeToEvict": True,
                 },
                 "true",
@@ -1522,15 +1522,17 @@ class TestWorker:
             (
                 {},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
-                    "celery": {"safeToEvict": True},
+                    "celery": {
+                        "safeToEvict": True,
+                        "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
+                    },
                 },
                 "true",
             ),
             (
                 {},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
+                    "celery": {"podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"}},
                     "safeToEvict": False,
                 },
                 "true",
@@ -1538,15 +1540,17 @@ class TestWorker:
             (
                 {},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
-                    "celery": {"safeToEvict": False},
+                    "celery": {
+                        "safeToEvict": False,
+                        "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
+                    },
                 },
                 "true",
             ),
             (
                 {},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+                    "celery": {"podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"}},
                     "safeToEvict": True,
                 },
                 "false",
@@ -1554,15 +1558,17 @@ class TestWorker:
             (
                 {},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
-                    "celery": {"safeToEvict": True},
+                    "celery": {
+                        "safeToEvict": True,
+                        "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+                    },
                 },
                 "false",
             ),
             (
                 {},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+                    "celery": {"podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"}},
                     "safeToEvict": False,
                 },
                 "false",
@@ -1570,8 +1576,10 @@ class TestWorker:
             (
                 {},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
-                    "celery": {"safeToEvict": False},
+                    "celery": {
+                        "safeToEvict": False,
+                        "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+                    },
                 },
                 "false",
             ),
@@ -1618,7 +1626,7 @@ class TestWorker:
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
+                    "celery": {"podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"}},
                     "safeToEvict": False,
                 },
                 "true",
@@ -1626,15 +1634,17 @@ class TestWorker:
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
-                    "celery": {"safeToEvict": False},
+                    "celery": {
+                        "safeToEvict": False,
+                        "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
+                    },
                 },
                 "true",
             ),
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+                    "celery": {"podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"}},
                     "safeToEvict": False,
                 },
                 "false",
@@ -1642,15 +1652,17 @@ class TestWorker:
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
-                    "celery": {"safeToEvict": False},
+                    "celery": {
+                        "safeToEvict": False,
+                        "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+                    },
                 },
                 "false",
             ),
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
+                    "celery": {"podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"}},
                     "safeToEvict": False,
                 },
                 "true",
@@ -1658,15 +1670,17 @@ class TestWorker:
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
-                    "celery": {"safeToEvict": False},
+                    "celery": {
+                        "safeToEvict": False,
+                        "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
+                    },
                 },
                 "true",
             ),
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+                    "celery": {"podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"}},
                     "safeToEvict": False,
                 },
                 "false",
@@ -1674,15 +1688,17 @@ class TestWorker:
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
-                    "celery": {"safeToEvict": False},
+                    "celery": {
+                        "safeToEvict": False,
+                        "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+                    },
                 },
                 "false",
             ),
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
+                    "celery": {"podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"}},
                     "safeToEvict": True,
                 },
                 "true",
@@ -1690,15 +1706,17 @@ class TestWorker:
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
-                    "celery": {"safeToEvict": True},
+                    "celery": {
+                        "safeToEvict": True,
+                        "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
+                    },
                 },
                 "true",
             ),
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+                    "celery": {"podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"}},
                     "safeToEvict": True,
                 },
                 "false",
@@ -1706,15 +1724,17 @@ class TestWorker:
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
-                    "celery": {"safeToEvict": True},
+                    "celery": {
+                        "safeToEvict": True,
+                        "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+                    },
                 },
                 "false",
             ),
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
+                    "celery": {"podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"}},
                     "safeToEvict": True,
                 },
                 "true",
@@ -1722,15 +1742,17 @@ class TestWorker:
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
-                    "celery": {"safeToEvict": True},
+                    "celery": {
+                        "safeToEvict": True,
+                        "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"},
+                    },
                 },
                 "true",
             ),
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+                    "celery": {"podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"}},
                     "safeToEvict": True,
                 },
                 "false",
@@ -1738,8 +1760,10 @@ class TestWorker:
             (
                 {"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
                 {
-                    "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
-                    "celery": {"safeToEvict": True},
+                    "celery": {
+                        "safeToEvict": True,
+                        "podAnnotations": 
{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"},
+                    },
                 },
                 "false",
             ),
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 5a46add7f63..c8a552332a1 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
@@ -3126,6 +3126,13 @@ class TestWorkerSets:
                     "sets": [{"name": "set1", "podAnnotations": {"test": 
"echo"}}],
                 },
             },
+            {
+                "celery": {
+                    "enableDefault": False,
+                    "podAnnotations": {"echo": "test"},
+                    "sets": [{"name": "set1", "podAnnotations": {"test": 
"echo"}}],
+                },
+            },
         ],
     )
     def test_overwrite_pod_annotations(self, workers_values):

Reply via email to