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 186cc48f907 [chart/v1-2x-test] Fix Kubernetes worker service account
values (#66598) (#66661)
186cc48f907 is described below
commit 186cc48f907cdf98d7fd5f7f5540e6b574b10f5e
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun May 10 19:14:09 2026 +0200
[chart/v1-2x-test] Fix Kubernetes worker service account values (#66598)
(#66661)
* Fix Kubernetes worker service account values
* Fix static checks
---------
(cherry picked from commit 4fc7a5325426a9ef68f53d4afe34a5bf8ea8a333)
Co-authored-by: Paul Kagiri <[email protected]>
Co-authored-by: Jens Scheffler <[email protected]>
---
chart/files/pod-template-file.kubernetes-helm-yaml | 2 +-
chart/templates/workers/worker-serviceaccount.yaml | 3 ++-
.../helm_tests/airflow_aux/test_pod_template_file.py | 19 +++++++++++++++++++
.../tests/helm_tests/airflow_core/test_worker.py | 18 ++++++++++++++++++
4 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/chart/files/pod-template-file.kubernetes-helm-yaml
b/chart/files/pod-template-file.kubernetes-helm-yaml
index 26b1b8505d0..3c1ad7ee585 100644
--- a/chart/files/pod-template-file.kubernetes-helm-yaml
+++ b/chart/files/pod-template-file.kubernetes-helm-yaml
@@ -236,7 +236,7 @@ spec:
terminationGracePeriodSeconds: {{
.Values.workers.kubernetes.terminationGracePeriodSeconds | default
.Values.workers.terminationGracePeriodSeconds }}
tolerations: {{- toYaml $tolerations | nindent 4 }}
topologySpreadConstraints: {{- toYaml $topologySpreadConstraints | nindent 4
}}
- {{- if .Values.workers.kubernetes.serviceAccount.create }}
+ {{- if has .Values.workers.kubernetes.serviceAccount.create (list true
false) }}
serviceAccountName: {{ include "worker.kubernetes.serviceAccountName" . }}
{{- else }}
serviceAccountName: {{ include "worker.serviceAccountName" . }}
diff --git a/chart/templates/workers/worker-serviceaccount.yaml
b/chart/templates/workers/worker-serviceaccount.yaml
index cbcf95381e8..a3da9f639ce 100644
--- a/chart/templates/workers/worker-serviceaccount.yaml
+++ b/chart/templates/workers/worker-serviceaccount.yaml
@@ -32,7 +32,8 @@
{{- $workers := (include "workersMergeValues" (list $mergedWorkers
$workerSet "" list) | fromYaml) -}}
{{- $_ := set $globals.Values "workers" $workers -}}
{{- with $globals -}}
-{{- if and .Values.workers.serviceAccount.create (include
"airflow.podLaunchingExecutor" .) }}
+{{- $useKubernetesServiceAccount := and (contains "KubernetesExecutor"
.Values.executor) (has .Values.workers.kubernetes.serviceAccount.create (list
true false)) -}}
+{{- if and .Values.workers.serviceAccount.create (include
"airflow.podLaunchingExecutor" .) (or (contains "CeleryExecutor"
.Values.executor) (not $useKubernetesServiceAccount)) }}
---
apiVersion: v1
kind: ServiceAccount
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 45b45700471..b86380403dd 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
@@ -2127,3 +2127,22 @@ class TestPodTemplateFile:
)
assert jmespath.search("spec.serviceAccountName", docs[0]) ==
"test-release-airflow-worker-kubernetes"
+
+ def test_dedicated_service_account_name_when_creation_disabled(self):
+ docs = render_chart(
+ name="test-release",
+ values={
+ "workers": {
+ "kubernetes": {
+ "serviceAccount": {
+ "create": False,
+ "name": "airflow",
+ }
+ }
+ }
+ },
+ show_only=["templates/pod-template-file.yaml"],
+ chart_dir=self.temp_chart_dir,
+ )
+
+ assert jmespath.search("spec.serviceAccountName", docs[0]) == "airflow"
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 5c4f07fddf0..6568e15b523 100644
--- a/helm-tests/tests/helm_tests/airflow_core/test_worker.py
+++ b/helm-tests/tests/helm_tests/airflow_core/test_worker.py
@@ -3034,6 +3034,24 @@ class TestWorkerKubernetesServiceAccount:
assert len(docs) == 1
+ def
test_should_not_create_legacy_service_account_when_k8s_service_account_disabled(self):
+ docs = render_chart(
+ values={
+ "executor": "KubernetesExecutor",
+ "workers": {
+ "kubernetes": {
+ "serviceAccount": {
+ "create": False,
+ "name": "airflow",
+ }
+ }
+ },
+ },
+ show_only=["templates/workers/worker-serviceaccount.yaml"],
+ )
+
+ assert len(docs) == 0
+
@pytest.mark.parametrize(
"executor",
[