shlomitubul commented on code in PR #64763:
URL: https://github.com/apache/airflow/pull/64763#discussion_r3069195163


##########
helm-tests/tests/helm_tests/airflow_aux/test_annotations.py:
##########
@@ -264,6 +264,99 @@ def test_annotations_are_added(self, values, show_only, 
expected_annotations):
             assert k in obj["metadata"]["annotations"]
             assert v == obj["metadata"]["annotations"][k]
 
+    @pytest.mark.parametrize(
+        ("values_key", "show_only"),
+        [
+            ("scheduler", "templates/scheduler/scheduler-serviceaccount.yaml"),
+            ("pgbouncer", "templates/pgbouncer/pgbouncer-serviceaccount.yaml"),
+            ("triggerer", "templates/triggerer/triggerer-serviceaccount.yaml"),
+        ],
+    )
+    def test_tpl_rendered_annotations_airflow_2(self, values_key, show_only):
+        """Test SA annotations support tpl rendering for Airflow 2.x 
components."""
+        component_values = {
+            "serviceAccount": {
+                "annotations": {
+                    "iam.gke.io/gcp-service-account": "{{ .Release.Name 
}}[email protected]",
+                },
+            },
+        }
+        if values_key == "pgbouncer":
+            component_values["enabled"] = True
+        k8s_objects = render_chart(
+            values={
+                "airflowVersion": "2.11.2",
+                values_key: component_values,
+            },
+            show_only=[show_only],
+        )
+        assert len(k8s_objects) == 1
+        annotations = k8s_objects[0]["metadata"]["annotations"]
+        assert annotations["iam.gke.io/gcp-service-account"] == 
"[email protected]"
+
+    @pytest.mark.parametrize(
+        ("values_key", "show_only"),
+        [
+            ("dagProcessor", 
"templates/dag-processor/dag-processor-serviceaccount.yaml"),
+            ("apiServer", 
"templates/api-server/api-server-serviceaccount.yaml"),
+        ],
+    )
+    def test_tpl_rendered_annotations_airflow_3(self, values_key, show_only):
+        """Test SA annotations support tpl rendering for Airflow 3.x 
components."""
+        k8s_objects = render_chart(
+            values={
+                "airflowVersion": "3.0.0",
+                values_key: {
+                    "serviceAccount": {
+                        "annotations": {
+                            "iam.gke.io/gcp-service-account": "{{ 
.Release.Name }}[email protected]",
+                        },
+                    },
+                },
+            },
+            show_only=[show_only],
+        )
+        assert len(k8s_objects) == 1
+        annotations = k8s_objects[0]["metadata"]["annotations"]
+        assert annotations["iam.gke.io/gcp-service-account"] == 
"[email protected]"
+
+    def test_tpl_rendered_annotations_worker(self):
+        """Test worker SA annotations support tpl rendering."""
+        k8s_objects = render_chart(
+            values={
+                "workers": {

Review Comment:
   Added `test_tpl_rendered_annotations_kubernetes_worker` — tests tpl 
rendering on the worker SA with `KubernetesExecutor` via 
`workers.serviceAccount.annotations`. The same `worker-serviceaccount.yaml` 
template serves both executors. All 23 SA annotation tests pass.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to