This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/master by this push:
new 441b4ef Add workers extraVolumes to Kubernetes pod template for Helm
Chart (#14743)
441b4ef is described below
commit 441b4ef19f07d8c72cd38a8565804e56e63b543c
Author: Dongyeon Lee <[email protected]>
AuthorDate: Wed Mar 31 19:01:56 2021 +0900
Add workers extraVolumes to Kubernetes pod template for Helm Chart (#14743)
---
chart/files/pod-template-file.kubernetes-helm-yaml | 6 ++++++
chart/tests/test_pod_template_file.py | 20 ++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/chart/files/pod-template-file.kubernetes-helm-yaml
b/chart/files/pod-template-file.kubernetes-helm-yaml
index 0a01e0a..1a93730 100644
--- a/chart/files/pod-template-file.kubernetes-helm-yaml
+++ b/chart/files/pod-template-file.kubernetes-helm-yaml
@@ -72,6 +72,9 @@ spec:
readOnly: true
subPath: {{.Values.dags.gitSync.dest }}/{{
.Values.dags.gitSync.subPath }}
{{- end }}
+{{- if .Values.workers.extraVolumeMounts }}
+{{ toYaml .Values.workers.extraVolumeMounts | indent 8 }}
+{{- end }}
hostNetwork: false
{{- if or .Values.registry.secretName .Values.registry.connection }}
imagePullSecrets:
@@ -108,3 +111,6 @@ spec:
- configMap:
name: {{ include "airflow_config" . }}
name: config
+{{- if .Values.workers.extraVolumes }}
+{{ toYaml .Values.workers.extraVolumes | indent 2 }}
+{{- end }}
diff --git a/chart/tests/test_pod_template_file.py
b/chart/tests/test_pod_template_file.py
index b2820ab..3ec6fb5 100644
--- a/chart/tests/test_pod_template_file.py
+++ b/chart/tests/test_pod_template_file.py
@@ -268,3 +268,23 @@ class PodTemplateFileTest(unittest.TestCase):
)
self.assertEqual(5000, jmespath.search("spec.securityContext.fsGroup",
docs[0]))
+
+ def test_should_create_valid_volume_mount_and_volume(self):
+ docs = render_chart(
+ values={
+ "workers": {
+ "extraVolumes": [{"name": "test-volume", "emptyDir": {}}],
+ "extraVolumeMounts": [{"name": "test-volume", "mountPath":
"/opt/test"}],
+ }
+ },
+ show_only=["templates/pod-template-file.yaml"],
+ )
+
+ assert "test-volume" == jmespath.search(
+ "spec.volumes[2].name",
+ docs[0],
+ )
+ assert "test-volume" == jmespath.search(
+ "spec.containers[0].volumeMounts[2].name",
+ docs[0],
+ )