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

Miretpl 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 e03cfa2f925 Add subdomain to worker pods in Deployments (#70026)
e03cfa2f925 is described below

commit e03cfa2f925495be3f8c5b751505aaaa29a58df4
Author: stephen-bracken <[email protected]>
AuthorDate: Thu Sep 17 22:05:46 2026 +0100

    Add subdomain to worker pods in Deployments (#70026)
    
    * Add subdomain to worker pods in Deployments
    
    When not using a StatefulSet, setting the `spec.subdomain` property on the 
pod to the service name will return the fully qualified service address for the 
pod when calling `airflow.utils.net.getfqdn`, allowing the UI to resolve the 
worker address and retrieve the logs.
    
    * Update chart/templates/workers/worker-deployment.yaml
    
    Co-authored-by: Przemysław Mirowski 
<[email protected]>
    
    * add tests for worker subdomain matching the service name
    
    ---------
    
    Co-authored-by: Przemysław Mirowski 
<[email protected]>
    Co-authored-by: Stephen Bracken <email-protected>
---
 chart/templates/workers/worker-deployment.yaml     |  3 +++
 chart/tests/helm_tests/airflow_core/test_worker.py | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/chart/templates/workers/worker-deployment.yaml 
b/chart/templates/workers/worker-deployment.yaml
index d5e2dcde962..51c38b157a7 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -124,6 +124,9 @@ spec:
           {{- tpl (toYaml $podAnnotations) . | nindent 8 }}
         {{- end }}
     spec:
+      {{- if not $persistence }}
+      subdomain: {{ include "airflow.fullname" . }}-worker{{ if ne 
.Values.workers.celery.name "default" }}-{{ .Values.workers.celery.name }}{{ 
end }}
+      {{- end }}
       {{- if .Values.workers.celery.runtimeClassName }}
       runtimeClassName: {{ .Values.workers.celery.runtimeClassName }}
       {{- end }}
diff --git a/chart/tests/helm_tests/airflow_core/test_worker.py 
b/chart/tests/helm_tests/airflow_core/test_worker.py
index 1ad6c5e3bb5..01d99cd5adc 100644
--- a/chart/tests/helm_tests/airflow_core/test_worker.py
+++ b/chart/tests/helm_tests/airflow_core/test_worker.py
@@ -1571,6 +1571,24 @@ class TestWorker:
             {"name": "test-extra-port", "containerPort": 10}
         ]
 
+    def test_worker_service_name_matches_service(self):
+        docs = render_chart(
+            values={"executor": "CeleryExecutor", "workers": {"celery": 
{"persistence": {"enabled": True}}}},
+            show_only=["templates/workers/worker-deployment.yaml", 
"templates/workers/worker-service.yaml"],
+        )
+
+        assert jmespath.search("spec.serviceName", docs[0]) == 
jmespath.search("metadata.name", docs[1])
+
+    def test_worker_subdomain_matches_service(self):
+        docs = render_chart(
+            values={"executor": "CeleryExecutor", "workers": {"celery": 
{"persistence": {"enabled": False}}}},
+            show_only=["templates/workers/worker-deployment.yaml", 
"templates/workers/worker-service.yaml"],
+        )
+
+        assert jmespath.search("spec.template.spec.subdomain", docs[0]) == 
jmespath.search(
+            "metadata.name", docs[1]
+        )
+
 
 class TestWorkerCeleryLogGroomer(LogGroomerTestBase):
     """Worker Celery groomer."""

Reply via email to