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 81c24e2  Allow Airflow UI to create worker pod via Clear > Run (#18272)
81c24e2 is described below

commit 81c24e2ab636540b423c84c0b824d0329fba63b4
Author: Kimyen Ladia <[email protected]>
AuthorDate: Mon Oct 25 16:49:45 2021 -0700

    Allow Airflow UI to create worker pod via Clear > Run (#18272)
---
 .../templates/webserver/webserver-deployment.yaml  |  6 ++++
 chart/tests/test_webserver.py                      | 33 ++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/chart/templates/webserver/webserver-deployment.yaml 
b/chart/templates/webserver/webserver-deployment.yaml
index 57e564d..4d76cd5 100644
--- a/chart/templates/webserver/webserver-deployment.yaml
+++ b/chart/templates/webserver/webserver-deployment.yaml
@@ -132,6 +132,12 @@ spec:
           resources:
 {{ toYaml .Values.webserver.resources | indent 12 }}
           volumeMounts:
+{{- if semverCompare ">=1.10.12" .Values.airflowVersion }}
+            - name: config
+              mountPath: {{ include "airflow_pod_template_file" . 
}}/pod_template_file.yaml
+              subPath: pod_template_file.yaml
+              readOnly: true
+{{- end }}
             - name: config
               mountPath: {{ template "airflow_config_path" . }}
               subPath: airflow.cfg
diff --git a/chart/tests/test_webserver.py b/chart/tests/test_webserver.py
index 00f61b9..1a20e81 100644
--- a/chart/tests/test_webserver.py
+++ b/chart/tests/test_webserver.py
@@ -236,6 +236,39 @@ class WebserverDeploymentTest(unittest.TestCase):
                 v["name"] for v in 
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
             ]
 
+    @parameterized.expand(
+        [
+            ("1.10.10", False),
+            ("1.10.12", True),
+            ("2.1.0", True),
+        ]
+    )
+    def test_config_volumes_and_mounts(self, af_version, 
pod_template_file_expected):
+        # setup
+        docs = render_chart(
+            values={"airflowVersion": af_version},
+            show_only=["templates/webserver/webserver-deployment.yaml"],
+        )
+
+        # default config
+        assert {
+            "name": "config",
+            "mountPath": "/opt/airflow/airflow.cfg",
+            "readOnly": True,
+            "subPath": "airflow.cfg",
+        } in jmespath.search("spec.template.spec.containers[0].volumeMounts", 
docs[0])
+
+        # pod_template_file config
+        assert pod_template_file_expected == (
+            {
+                "name": "config",
+                "mountPath": 
"/opt/airflow/pod_templates/pod_template_file.yaml",
+                "readOnly": True,
+                "subPath": "pod_template_file.yaml",
+            }
+            in 
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+        )
+
     def test_webserver_resources_are_configurable(self):
         docs = render_chart(
             values={

Reply via email to