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 5ed0020e89c [chart/v1-2x-test] Add workers.celery.hostAliases &
workers.kubernetes.hostAliases (#61960) (#64412)
5ed0020e89c is described below
commit 5ed0020e89c2f18658274ade13bb4f92cb9c95fc
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun Mar 29 19:08:53 2026 +0200
[chart/v1-2x-test] Add workers.celery.hostAliases &
workers.kubernetes.hostAliases (#61960) (#64412)
* Add workers.celery.hostAliases & workers.kubernetes.hostAliases
* Deprecate workers.hostAliases
(cherry picked from commit e1332e4756977c799951be99b3923944b9848ca5)
Co-authored-by: Przemysław Mirowski <[email protected]>
---
chart/files/pod-template-file.kubernetes-helm-yaml | 4 +-
chart/newsfragments/61960.significant.rst | 1 +
chart/templates/NOTES.txt | 8 ++++
chart/values.schema.json | 46 +++++++++++++++++++++-
chart/values.yaml | 24 +++++++++++
.../airflow_aux/test_pod_template_file.py | 24 +++++++----
.../tests/helm_tests/airflow_core/test_worker.py | 25 +++++++-----
.../helm_tests/airflow_core/test_worker_sets.py | 9 +++++
8 files changed, 121 insertions(+), 20 deletions(-)
diff --git a/chart/files/pod-template-file.kubernetes-helm-yaml
b/chart/files/pod-template-file.kubernetes-helm-yaml
index aece6eabf9b..29c0d949350 100644
--- a/chart/files/pod-template-file.kubernetes-helm-yaml
+++ b/chart/files/pod-template-file.kubernetes-helm-yaml
@@ -223,8 +223,8 @@ spec:
runtimeClassName: {{ .Values.workers.runtimeClassName }}
{{- end }}
imagePullSecrets: {{- include "image_pull_secrets" . | nindent 4 }}
- {{- if .Values.workers.hostAliases }}
- hostAliases: {{- toYaml .Values.workers.hostAliases | nindent 4 }}
+ {{- if or .Values.workers.kubernetes.hostAliases .Values.workers.hostAliases
}}
+ hostAliases: {{- toYaml (.Values.workers.kubernetes.hostAliases | default
.Values.workers.hostAliases) | nindent 4 }}
{{- end }}
restartPolicy: Never
securityContext: {{ $securityContext | nindent 4 }}
diff --git a/chart/newsfragments/61960.significant.rst
b/chart/newsfragments/61960.significant.rst
new file mode 100644
index 00000000000..eef9d8e1f17
--- /dev/null
+++ b/chart/newsfragments/61960.significant.rst
@@ -0,0 +1 @@
+``workers.hostAliases`` section is now deprecated in favor of
``workers.celery.hostAliases`` and ``workers.kubernetes.hostAliases``. Please
update your configuration accordingly.
diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt
index 989d6dfb05f..28f43dc78f8 100644
--- a/chart/templates/NOTES.txt
+++ b/chart/templates/NOTES.txt
@@ -645,6 +645,14 @@ DEPRECATION WARNING:
{{- end }}
+{{- if not (empty .Values.workers.hostAliases) }}
+
+ DEPRECATION WARNING:
+ `workers.hostAliases` has been renamed to
`workers.celery.hostAliases`/`workers.kubernetes.hostAliases`.
+ Please change your values as support for the old name will be dropped in a
future release.
+
+{{- end }}
+
{{- if not (empty .Values.webserver.defaultUser) }}
DEPRECATION WARNING:
diff --git a/chart/values.schema.json b/chart/values.schema.json
index c6b06707539..df49e96df38 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -2381,7 +2381,7 @@
}
},
"hostAliases": {
- "description": "Specify HostAliases for Airflow Celery
worker pods and pods created with pod-template-file.",
+ "description": "Specify HostAliases for Airflow Celery
worker pods and pods created with pod-template-file (deprecated, use
``workers.celery.hostAliases`` and/or ``workers.kubernetes.hostAliases``
instead).",
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.HostAlias"
},
@@ -3309,6 +3309,28 @@
"additionalProperties": {
"type": "string"
}
+ },
+ "hostAliases": {
+ "description": "Specify HostAliases for Airflow
Celery worker pods.",
+ "items": {
+ "$ref":
"#/definitions/io.k8s.api.core.v1.HostAlias"
+ },
+ "type": "array",
+ "default": [],
+ "examples": [
+ {
+ "ip": "127.0.0.2",
+ "hostnames": [
+ "test.hostname.one"
+ ]
+ },
+ {
+ "ip": "127.0.0.3",
+ "hostnames": [
+ "test.hostname.two"
+ ]
+ }
+ ]
}
}
},
@@ -3606,6 +3628,28 @@
"additionalProperties": {
"type": "string"
}
+ },
+ "hostAliases": {
+ "description": "Specify HostAliases for pods
created with pod-template-file.",
+ "items": {
+ "$ref":
"#/definitions/io.k8s.api.core.v1.HostAlias"
+ },
+ "type": "array",
+ "default": [],
+ "examples": [
+ {
+ "ip": "127.0.0.2",
+ "hostnames": [
+ "test.hostname.one"
+ ]
+ },
+ {
+ "ip": "127.0.0.3",
+ "hostnames": [
+ "test.hostname.two"
+ ]
+ }
+ ]
}
}
}
diff --git a/chart/values.yaml b/chart/values.yaml
index b10b06fca89..32f7ed9883c 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -1076,7 +1076,9 @@ workers:
# weight: 100
tolerations: []
topologySpreadConstraints: []
+
# hostAliases to use in Airflow Celery worker pods and pods created with
pod-template-file
+ # (deprecated, use workers.celery.nodeSelector and/or
workers.kubernetes.nodeSelector instead)
# See:
#
https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/
hostAliases: []
@@ -1390,6 +1392,17 @@ workers:
# Select certain nodes for Airflow Celery worker pods
nodeSelector: {}
+ # 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/
+ hostAliases: []
+ # - ip: "127.0.0.2"
+ # hostnames:
+ # - "test.hostname.one"
+ # - ip: "127.0.0.3"
+ # hostnames:
+ # - "test.hostname.two"
+
kubernetes:
# Command to use in pod-template-file (templated)
command: ~
@@ -1463,6 +1476,17 @@ workers:
# Select certain nodes for pods created with pod-template-file
nodeSelector: {}
+ # 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/
+ hostAliases: []
+ # - ip: "127.0.0.2"
+ # hostnames:
+ # - "test.hostname.one"
+ # - ip: "127.0.0.3"
+ # hostnames:
+ # - "test.hostname.two"
+
# Airflow scheduler settings
scheduler:
enabled: true
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 f4c2971d6ce..4ff0b496daa 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
@@ -1168,19 +1168,27 @@ class TestPodTemplateFile:
)
assert jmespath.search("spec.containers[0].resources", docs[0]) == {}
- def test_workers_host_aliases(self):
- docs = render_chart(
- values={
- "workers": {
- "hostAliases": [{"ip": "127.0.0.2", "hostnames":
["test.hostname"]}],
- },
+ @pytest.mark.parametrize(
+ "workers_values",
+ [
+ {"hostAliases": [{"ip": "127.0.0.2", "hostnames":
["test.hostname"]}]},
+ {"kubernetes": {"hostAliases": [{"ip": "127.0.0.2", "hostnames":
["test.hostname"]}]}},
+ {
+ "hostAliases": [{"ip": "192.168.0.1", "hostnames":
["hostname"]}],
+ "kubernetes": {"hostAliases": [{"ip": "127.0.0.2",
"hostnames": ["test.hostname"]}]},
},
+ ],
+ )
+ def test_workers_host_aliases(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("spec.hostAliases[0].ip", docs[0]) ==
"127.0.0.2"
- assert jmespath.search("spec.hostAliases[0].hostnames[0]", docs[0]) ==
"test.hostname"
+ assert jmespath.search("spec.hostAliases", docs[0]) == [
+ {"ip": "127.0.0.2", "hostnames": ["test.hostname"]}
+ ]
def test_workers_priority_class_name(self):
docs = render_chart(
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 d08df7c07da..57e4b3a0146 100644
--- a/helm-tests/tests/helm_tests/airflow_core/test_worker.py
+++ b/helm-tests/tests/helm_tests/airflow_core/test_worker.py
@@ -390,19 +390,26 @@ class TestWorker:
assert "test_label" in
jmespath.search("spec.template.metadata.labels", docs[0])
assert jmespath.search("spec.template.metadata.labels",
docs[0])["test_label"] == "test_label_value"
- def test_workers_host_aliases(self):
- docs = render_chart(
- values={
- "executor": "CeleryExecutor",
- "workers": {
- "hostAliases": [{"ip": "127.0.0.2", "hostnames":
["test.hostname"]}],
- },
+ @pytest.mark.parametrize(
+ "workers_values",
+ [
+ {"hostAliases": [{"ip": "127.0.0.2", "hostnames":
["test.hostname"]}]},
+ {"celery": {"hostAliases": [{"ip": "127.0.0.2", "hostnames":
["test.hostname"]}]}},
+ {
+ "hostAliases": [{"ip": "192.168.0.1", "hostnames":
["hostname"]}],
+ "celery": {"hostAliases": [{"ip": "127.0.0.2", "hostnames":
["test.hostname"]}]},
},
+ ],
+ )
+ def test_workers_host_aliases(self, workers_values):
+ docs = render_chart(
+ values={"executor": "CeleryExecutor", "workers": workers_values},
show_only=["templates/workers/worker-deployment.yaml"],
)
- assert jmespath.search("spec.template.spec.hostAliases[0].ip",
docs[0]) == "127.0.0.2"
- assert
jmespath.search("spec.template.spec.hostAliases[0].hostnames[0]", docs[0]) ==
"test.hostname"
+ assert jmespath.search("spec.template.spec.hostAliases", docs[0]) == [
+ {"ip": "127.0.0.2", "hostnames": ["test.hostname"]}
+ ]
@pytest.mark.parametrize(
("workers_values", "expected_update_strategy"),
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 ef6dcb39f65..076a3fd305b 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
@@ -2755,6 +2755,15 @@ class TestWorkerSets:
],
},
},
+ {
+ "celery": {
+ "hostAliases": [{"ip": "192.168.0.0", "hostnames":
["test"]}],
+ "enableDefault": False,
+ "sets": [
+ {"name": "set1", "hostAliases": [{"ip": "127.0.0.2",
"hostnames": ["test.hostname"]}]}
+ ],
+ },
+ },
],
)
def test_overwrite_host_aliases(self, workers_values):