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

ash 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 b23a4cd  Adds option to set extraVolumeMounts for git-sync container 
(#14837)
b23a4cd is described below

commit b23a4cd6631ba3346787b285a7bdafd5e71b43b0
Author: DerekHeldtWerle <[email protected]>
AuthorDate: Fri Mar 19 05:15:44 2021 -0700

    Adds option to set extraVolumeMounts for git-sync container (#14837)
---
 chart/templates/_helpers.yaml          |  3 +++
 chart/tests/test_git_sync_scheduler.py | 27 +++++++++++++++++++++++++++
 chart/values.schema.json               |  4 ++++
 chart/values.yaml                      |  1 +
 4 files changed, 35 insertions(+)

diff --git a/chart/templates/_helpers.yaml b/chart/templates/_helpers.yaml
index 90e1318..8c93883 100644
--- a/chart/templates/_helpers.yaml
+++ b/chart/templates/_helpers.yaml
@@ -185,6 +185,9 @@
     subPath: known_hosts
   {{- end }}
   {{- end }}
+{{- if and .Values.dags.gitSync.enabled .Values.dags.gitSync.extraVolumeMounts 
}}
+{{ toYaml .Values.dags.gitSync.extraVolumeMounts | indent 2 }}
+{{- end }}
 {{- end }}
 
 # This helper will change when customers deploy a new image.
diff --git a/chart/tests/test_git_sync_scheduler.py 
b/chart/tests/test_git_sync_scheduler.py
index f0740cb..68129fc 100644
--- a/chart/tests/test_git_sync_scheduler.py
+++ b/chart/tests/test_git_sync_scheduler.py
@@ -188,3 +188,30 @@ class GitSyncSchedulerTest(unittest.TestCase):
         assert {"name": "test-volume", "mountPath": "/opt/test"} in 
jmespath.search(
             "spec.template.spec.containers[0].volumeMounts", docs[0]
         )
+
+    def test_extra_volume_and_git_sync_extra_volume_mount(self):
+        docs = render_chart(
+            values={
+                "executor": "CeleryExecutor",
+                "scheduler": {
+                    "extraVolumes": [{"name": "test-volume", "emptyDir": {}}],
+                },
+                "dags": {
+                    "gitSync": {
+                        "enabled": True,
+                        "extraVolumeMounts": [{"mountPath": "/opt/test", 
"name": "test-volume"}],
+                    }
+                },
+            },
+            show_only=["templates/scheduler/scheduler-deployment.yaml"],
+        )
+
+        assert {"name": "test-volume", "emptyDir": {}} in jmespath.search(
+            "spec.template.spec.volumes", docs[0]
+        )
+        assert {'mountPath': '/git', 'name': 'dags'} in jmespath.search(
+            "spec.template.spec.containers[1].volumeMounts", docs[0]
+        )
+        assert {"name": "test-volume", "mountPath": "/opt/test"} in 
jmespath.search(
+            "spec.template.spec.containers[1].volumeMounts", docs[0]
+        )
diff --git a/chart/values.schema.json b/chart/values.schema.json
index b4f16ef..1bc3e2e 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -1446,6 +1446,10 @@
                             "description": "Git sync container run as user 
parameter.",
                             "type": "integer"
                         },
+                        "extraVolumeMounts": {
+                            "description": "Mount additional volumes into git 
sync container.",
+                            "type": "array"
+                        },
                         "credentialsSecret": {
                             "description": "TODO",
                             "type": ["string", "null"]
diff --git a/chart/values.yaml b/chart/values.yaml
index 9669af3..9794cdd 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -838,3 +838,4 @@ dags:
     wait: 60
     containerName: git-sync
     uid: 65533
+    extraVolumeMounts: []

Reply via email to