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

jedcunningham 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 21063267fd Chart: add hostaliases to pod template file (#27544)
21063267fd is described below

commit 21063267fd9764b2ca38669e8faec75d9b87179c
Author: Aakcht <[email protected]>
AuthorDate: Thu Nov 10 01:10:03 2022 +0600

    Chart: add hostaliases to pod template file (#27544)
---
 chart/files/pod-template-file.kubernetes-helm-yaml |  4 ++++
 tests/charts/test_pod_template_file.py             | 14 ++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/chart/files/pod-template-file.kubernetes-helm-yaml 
b/chart/files/pod-template-file.kubernetes-helm-yaml
index f59af3d0ea..dac3ae1c4e 100644
--- a/chart/files/pod-template-file.kubernetes-helm-yaml
+++ b/chart/files/pod-template-file.kubernetes-helm-yaml
@@ -90,6 +90,10 @@ spec:
   imagePullSecrets:
     - name: {{ template "registry_secret" . }}
   {{- end }}
+{{- if .Values.workers.hostAliases }}
+  hostAliases:
+{{ toYaml .Values.workers.hostAliases | indent 4 }}
+{{- end }}
   restartPolicy: Never
   securityContext: {{ $securityContext | nindent 4 }}
   nodeSelector: {{ toYaml $nodeSelector | nindent 4 }}
diff --git a/tests/charts/test_pod_template_file.py 
b/tests/charts/test_pod_template_file.py
index 722b69eae1..fa5a9128c0 100644
--- a/tests/charts/test_pod_template_file.py
+++ b/tests/charts/test_pod_template_file.py
@@ -704,3 +704,17 @@ class TestPodTemplateFile:
             chart_dir=self.temp_chart_dir,
         )
         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"]}],
+                },
+            },
+            show_only=["templates/pod-template-file.yaml"],
+            chart_dir=self.temp_chart_dir,
+        )
+
+        assert "127.0.0.2" == jmespath.search("spec.hostAliases[0].ip", 
docs[0])
+        assert "test.hostname" == 
jmespath.search("spec.hostAliases[0].hostnames[0]", docs[0])

Reply via email to