This is an automated email from the ASF dual-hosted git repository.
potiuk 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 b09e1f97d5 Fix dagProcessor not including webserver-config volume
(#32644)
b09e1f97d5 is described below
commit b09e1f97d57ed9c57591b02e3d578427f3890da2
Author: Carlos Sánchez Páez <[email protected]>
AuthorDate: Fri Jul 21 10:35:16 2023 +0200
Fix dagProcessor not including webserver-config volume (#32644)
---
.../dag-processor/dag-processor-deployment.yaml | 5 +++
helm_tests/airflow_core/test_dag_processor.py | 39 ++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/chart/templates/dag-processor/dag-processor-deployment.yaml
b/chart/templates/dag-processor/dag-processor-deployment.yaml
index 0e0e52578a..e748e9dff4 100644
--- a/chart/templates/dag-processor/dag-processor-deployment.yaml
+++ b/chart/templates/dag-processor/dag-processor-deployment.yaml
@@ -220,6 +220,11 @@ spec:
- name: config
configMap:
name: {{ template "airflow_config" . }}
+ {{- if or .Values.webserver.webserverConfig
.Values.webserver.webserverConfigConfigMapName }}
+ - name: webserver-config
+ configMap:
+ name: {{ template "airflow_webserver_config_configmap_name" . }}
+ {{- end }}
{{- if .Values.dags.persistence.enabled }}
- name: dags
persistentVolumeClaim:
diff --git a/helm_tests/airflow_core/test_dag_processor.py
b/helm_tests/airflow_core/test_dag_processor.py
index c25fea08ab..c1c1363474 100644
--- a/helm_tests/airflow_core/test_dag_processor.py
+++ b/helm_tests/airflow_core/test_dag_processor.py
@@ -579,6 +579,45 @@ class TestDagProcessor:
assert "annotations" in jmespath.search("metadata", docs[0])
assert jmespath.search("metadata.annotations",
docs[0])["test_annotation"] == "test_annotation_value"
+ @pytest.mark.parametrize(
+ "webserver_config, should_add_volume",
+ [
+ ("CSRF_ENABLED = True", True),
+ (None, False),
+ ],
+ )
+ def test_should_add_webserver_config_volume_and_volume_mount_when_exists(
+ self, webserver_config, should_add_volume
+ ):
+ expected_volume = {
+ "name": "webserver-config",
+ "configMap": {"name": "release-name-webserver-config"},
+ }
+ expected_volume_mount = {
+ "name": "webserver-config",
+ "mountPath": "/opt/airflow/webserver_config.py",
+ "subPath": "webserver_config.py",
+ "readOnly": True,
+ }
+
+ docs = render_chart(
+ values={
+ "dagProcessor": {"enabled": True},
+ "webserver": {"webserverConfig": webserver_config},
+ },
+
show_only=["templates/dag-processor/dag-processor-deployment.yaml"],
+ )
+
+ created_volumes = jmespath.search("spec.template.spec.volumes",
docs[0])
+ created_volume_mounts =
jmespath.search("spec.template.spec.containers[1].volumeMounts", docs[0])
+
+ if should_add_volume:
+ assert expected_volume in created_volumes
+ assert expected_volume_mount in created_volume_mounts
+ else:
+ assert expected_volume not in created_volumes
+ assert expected_volume_mount not in created_volume_mounts
+
class TestDagProcessorLogGroomer(LogGroomerTestBase):
"""DAG processor log groomer."""