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 93617572e9 Chart: add airflow_local_settings to all airflow containers
(#27779)
93617572e9 is described below
commit 93617572e9990ff5384b74e2387561ec2b236d60
Author: Aakcht <[email protected]>
AuthorDate: Tue Nov 29 22:23:51 2022 +0300
Chart: add airflow_local_settings to all airflow containers (#27779)
---
chart/files/pod-template-file.kubernetes-helm-yaml | 11 +--------
chart/templates/_helpers.yaml | 13 ++++++++++
chart/templates/cleanup/cleanup-cronjob.yaml | 5 +---
.../dag-processor/dag-processor-deployment.yaml | 16 ++-----------
chart/templates/flower/flower-deployment.yaml | 5 +---
chart/templates/jobs/create-user-job.yaml | 5 +---
chart/templates/jobs/migrate-database-job.yaml | 5 +---
.../templates/scheduler/scheduler-deployment.yaml | 16 ++-----------
.../templates/triggerer/triggerer-deployment.yaml | 16 ++-----------
.../templates/webserver/webserver-deployment.yaml | 16 ++-----------
chart/templates/workers/worker-deployment.yaml | 27 +++------------------
tests/charts/test_cleanup_pods.py | 28 ++++++++++++++++++++++
tests/charts/test_create_user_job.py | 19 +++++++++++++++
tests/charts/test_dag_processor.py | 24 +++++++++++++++++++
tests/charts/test_flower.py | 21 ++++++++++++++++
tests/charts/test_migrate_database_job.py | 19 +++++++++++++++
tests/charts/test_scheduler.py | 8 +++++--
tests/charts/test_triggerer.py | 23 ++++++++++++++++++
tests/charts/test_webserver.py | 8 +++++--
tests/charts/test_worker.py | 8 +++++--
20 files changed, 181 insertions(+), 112 deletions(-)
diff --git a/chart/files/pod-template-file.kubernetes-helm-yaml
b/chart/files/pod-template-file.kubernetes-helm-yaml
index dac3ae1c4e..80a907e752 100644
--- a/chart/files/pod-template-file.kubernetes-helm-yaml
+++ b/chart/files/pod-template-file.kubernetes-helm-yaml
@@ -67,16 +67,7 @@ spec:
volumeMounts:
- mountPath: {{ template "airflow_logs" . }}
name: logs
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
-{{- if .Values.airflowLocalSettings }}
- - name: config
- mountPath: {{ template "airflow_local_setting_path" . }}
- subPath: airflow_local_settings.py
- readOnly: true
-{{- end }}
+{{- include "airflow_config_mount" . | nindent 8 }}
{{- if or .Values.dags.gitSync.enabled .Values.dags.persistence.enabled }}
{{- include "airflow_dags_mount" . | nindent 8 }}
{{- end }}
diff --git a/chart/templates/_helpers.yaml b/chart/templates/_helpers.yaml
index 1ff7a64cae..f3cafc0373 100644
--- a/chart/templates/_helpers.yaml
+++ b/chart/templates/_helpers.yaml
@@ -451,6 +451,19 @@ server_tls_key_file = /etc/pgbouncer/server.key
{{ (printf "%s-airflow-config" .Release.Name) }}
{{- end }}
+{{ define "airflow_config_mount" -}}
+- name: config
+ mountPath: {{ template "airflow_config_path" . }}
+ subPath: airflow.cfg
+ readOnly: true
+ {{- if .Values.airflowLocalSettings }}
+- name: config
+ mountPath: {{ template "airflow_local_setting_path" . }}
+ subPath: airflow_local_settings.py
+ readOnly: true
+ {{- end }}
+{{- end -}}
+
{{/*
Create the name of the webserver service account to use
*/}}
diff --git a/chart/templates/cleanup/cleanup-cronjob.yaml
b/chart/templates/cleanup/cleanup-cronjob.yaml
index eb83fe04b2..fa93a73075 100644
--- a/chart/templates/cleanup/cleanup-cronjob.yaml
+++ b/chart/templates/cleanup/cleanup-cronjob.yaml
@@ -101,10 +101,7 @@ spec:
{{- include "standard_airflow_environment" . | indent 12 }}
{{- include "container_extra_envs" (list . .Values.cleanup.env)
| indent 12 }}
volumeMounts:
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
+{{- include "airflow_config_mount" . | nindent 16 }}
resources:
{{ toYaml .Values.cleanup.resources | indent 16 }}
volumes:
diff --git a/chart/templates/dag-processor/dag-processor-deployment.yaml
b/chart/templates/dag-processor/dag-processor-deployment.yaml
index d4e6e1f790..fef28af5aa 100644
--- a/chart/templates/dag-processor/dag-processor-deployment.yaml
+++ b/chart/templates/dag-processor/dag-processor-deployment.yaml
@@ -116,10 +116,7 @@ spec:
image: {{ template "airflow_image_for_migrations" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
+{{- include "airflow_config_mount" . | nindent 12 }}
args:
{{- include "wait-for-migrations-command" . | nindent 10 }}
envFrom:
@@ -155,16 +152,7 @@ spec:
{{- end }}
- name: logs
mountPath: {{ template "airflow_logs" . }}
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
- {{- if .Values.airflowLocalSettings }}
- - name: config
- mountPath: {{ template "airflow_local_setting_path" . }}
- subPath: airflow_local_settings.py
- readOnly: true
- {{- end }}
+{{- include "airflow_config_mount" . | nindent 12 }}
{{- if or .Values.dags.persistence.enabled
.Values.dags.gitSync.enabled }}
{{- include "airflow_dags_mount" . | nindent 12 }}
{{- end }}
diff --git a/chart/templates/flower/flower-deployment.yaml
b/chart/templates/flower/flower-deployment.yaml
index f8c9b2a663..ca39b369d4 100644
--- a/chart/templates/flower/flower-deployment.yaml
+++ b/chart/templates/flower/flower-deployment.yaml
@@ -96,10 +96,7 @@ spec:
resources:
{{ toYaml .Values.flower.resources | indent 12 }}
volumeMounts:
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
+{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.flower.extraVolumeMounts }}
{{ toYaml .Values.flower.extraVolumeMounts | nindent 12 }}
{{- end }}
diff --git a/chart/templates/jobs/create-user-job.yaml
b/chart/templates/jobs/create-user-job.yaml
index 16029a9dda..784ae05262 100644
--- a/chart/templates/jobs/create-user-job.yaml
+++ b/chart/templates/jobs/create-user-job.yaml
@@ -105,10 +105,7 @@ spec:
resources:
{{ toYaml .Values.createUserJob.resources | indent 12 }}
volumeMounts:
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
+{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.createUserJob.extraVolumeMounts }}
{{ toYaml .Values.createUserJob.extraVolumeMounts | nindent 12 }}
{{- end }}
diff --git a/chart/templates/jobs/migrate-database-job.yaml
b/chart/templates/jobs/migrate-database-job.yaml
index 84e51880d4..5669fe2d40 100644
--- a/chart/templates/jobs/migrate-database-job.yaml
+++ b/chart/templates/jobs/migrate-database-job.yaml
@@ -106,10 +106,7 @@ spec:
resources:
{{ toYaml .Values.migrateDatabaseJob.resources | indent 12 }}
volumeMounts:
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
+{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.migrateDatabaseJob.extraVolumeMounts }}
{{ toYaml .Values.migrateDatabaseJob.extraVolumeMounts | nindent 12 }}
{{- end }}
diff --git a/chart/templates/scheduler/scheduler-deployment.yaml
b/chart/templates/scheduler/scheduler-deployment.yaml
index cc6563d8ad..89e5ab3d8c 100644
--- a/chart/templates/scheduler/scheduler-deployment.yaml
+++ b/chart/templates/scheduler/scheduler-deployment.yaml
@@ -136,10 +136,7 @@ spec:
image: {{ template "airflow_image_for_migrations" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
+{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.scheduler.extraVolumeMounts }}
{{ toYaml .Values.scheduler.extraVolumeMounts | indent 12 }}
{{- end }}
@@ -206,16 +203,7 @@ spec:
{{- end }}
- name: logs
mountPath: {{ template "airflow_logs" . }}
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
- {{- if .Values.airflowLocalSettings }}
- - name: config
- mountPath: {{ template "airflow_local_setting_path" . }}
- subPath: airflow_local_settings.py
- readOnly: true
- {{- end }}
+{{- include "airflow_config_mount" . | nindent 12 }}
{{- if and $localOrDagProcessorDisabled (or .Values.dags.persistence.enabled
.Values.dags.gitSync.enabled) }}
{{- include "airflow_dags_mount" . | nindent 12 }}
{{- end }}
diff --git a/chart/templates/triggerer/triggerer-deployment.yaml
b/chart/templates/triggerer/triggerer-deployment.yaml
index b5ef86b82f..d79bc5ccc4 100644
--- a/chart/templates/triggerer/triggerer-deployment.yaml
+++ b/chart/templates/triggerer/triggerer-deployment.yaml
@@ -116,10 +116,7 @@ spec:
image: {{ template "airflow_image_for_migrations" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
+{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.triggerer.extraVolumeMounts }}
{{ toYaml .Values.triggerer.extraVolumeMounts | nindent 12 }}
{{- end }}
@@ -158,16 +155,7 @@ spec:
{{- end }}
- name: logs
mountPath: {{ template "airflow_logs" . }}
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
- {{- if .Values.airflowLocalSettings }}
- - name: config
- mountPath: {{ template "airflow_local_setting_path" . }}
- subPath: airflow_local_settings.py
- readOnly: true
- {{- end }}
+{{- include "airflow_config_mount" . | nindent 12 }}
{{- if or .Values.dags.persistence.enabled
.Values.dags.gitSync.enabled }}
{{- include "airflow_dags_mount" . | nindent 12 }}
{{- end }}
diff --git a/chart/templates/webserver/webserver-deployment.yaml
b/chart/templates/webserver/webserver-deployment.yaml
index 386e10a3b7..e745eed6a8 100644
--- a/chart/templates/webserver/webserver-deployment.yaml
+++ b/chart/templates/webserver/webserver-deployment.yaml
@@ -128,10 +128,7 @@ spec:
image: {{ template "airflow_image_for_migrations" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
+{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.webserver.extraVolumeMounts }}
{{ toYaml .Values.webserver.extraVolumeMounts | indent 12 }}
{{- end }}
@@ -171,22 +168,13 @@ spec:
subPath: pod_template_file.yaml
readOnly: true
{{- end }}
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
+{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.webserver.webserverConfig }}
- name: webserver-config
mountPath: {{ template "airflow_webserver_config_path" . }}
subPath: webserver_config.py
readOnly: true
{{- end }}
-{{- if .Values.airflowLocalSettings }}
- - name: config
- mountPath: {{ template "airflow_local_setting_path" . }}
- subPath: airflow_local_settings.py
- readOnly: true
-{{- end }}
{{- if and (semverCompare "<2.0.0" .Values.airflowVersion) (or
.Values.dags.gitSync.enabled .Values.dags.persistence.enabled) }}
{{- include "airflow_dags_mount" . | nindent 12 }}
{{- end }}
diff --git a/chart/templates/workers/worker-deployment.yaml
b/chart/templates/workers/worker-deployment.yaml
index b0ed1cfe95..c60b09ce3e 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -146,10 +146,7 @@ spec:
image: {{ template "airflow_image_for_migrations" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
+{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.workers.extraVolumeMounts }}
{{ toYaml .Values.workers.extraVolumeMounts | indent 12 }}
{{- end }}
@@ -206,10 +203,7 @@ spec:
{{- end }}
- name: logs
mountPath: {{ template "airflow_logs" . }}
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
+{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.workers.kerberosSidecar.enabled }}
- name: config
mountPath: {{ .Values.kerberos.configPath | quote }}
@@ -219,12 +213,6 @@ spec:
mountPath: {{ .Values.kerberos.ccacheMountPath | quote }}
readOnly: true
{{- end }}
- {{- if .Values.airflowLocalSettings }}
- - name: config
- mountPath: {{ template "airflow_local_setting_path" . }}
- subPath: airflow_local_settings.py
- readOnly: true
- {{- end }}
{{- if or .Values.dags.persistence.enabled
.Values.dags.gitSync.enabled }}
{{- include "airflow_dags_mount" . | nindent 12 }}
{{- end }}
@@ -280,20 +268,11 @@ spec:
volumeMounts:
- name: logs
mountPath: {{ template "airflow_logs" . }}
- - name: config
- mountPath: {{ template "airflow_config_path" . }}
- subPath: airflow.cfg
- readOnly: true
+{{- include "airflow_config_mount" . | nindent 12 }}
- name: config
mountPath: {{ .Values.kerberos.configPath | quote }}
subPath: krb5.conf
readOnly: true
- {{- if .Values.airflowLocalSettings }}
- - name: config
- mountPath: {{ template "airflow_local_setting_path" . }}
- subPath: airflow_local_settings.py
- readOnly: true
- {{- end }}
- name: kerberos-keytab
subPath: "kerberos.keytab"
mountPath: {{ .Values.kerberos.keytabPath | quote }}
diff --git a/tests/charts/test_cleanup_pods.py
b/tests/charts/test_cleanup_pods.py
index 720676f914..f6b15a5f6b 100644
--- a/tests/charts/test_cleanup_pods.py
+++ b/tests/charts/test_cleanup_pods.py
@@ -239,6 +239,34 @@ class TestCleanupPods:
assert 2 == jmespath.search("spec.failedJobsHistoryLimit", docs[0])
assert 4 == jmespath.search("spec.successfulJobsHistoryLimit", docs[0])
+ def test_no_airflow_local_settings(self):
+ docs = render_chart(
+ values={
+ "cleanup": {"enabled": True},
+ "airflowLocalSettings": None,
+ },
+ show_only=["templates/cleanup/cleanup-cronjob.yaml"],
+ )
+ volume_mounts = jmespath.search(
+ "spec.jobTemplate.spec.template.spec.containers[0].volumeMounts",
docs[0]
+ )
+ assert "airflow_local_settings.py" not in str(volume_mounts)
+
+ def test_airflow_local_settings(self):
+ docs = render_chart(
+ values={
+ "cleanup": {"enabled": True},
+ "airflowLocalSettings": "# Well hello!",
+ },
+ show_only=["templates/cleanup/cleanup-cronjob.yaml"],
+ )
+ assert {
+ "name": "config",
+ "mountPath": "/opt/airflow/config/airflow_local_settings.py",
+ "subPath": "airflow_local_settings.py",
+ "readOnly": True,
+ } in
jmespath.search("spec.jobTemplate.spec.template.spec.containers[0].volumeMounts",
docs[0])
+
class TestCleanupServiceAccount:
def test_should_add_component_specific_labels(self):
diff --git a/tests/charts/test_create_user_job.py
b/tests/charts/test_create_user_job.py
index 7deebb58b3..74c0fa9f44 100644
--- a/tests/charts/test_create_user_job.py
+++ b/tests/charts/test_create_user_job.py
@@ -319,6 +319,25 @@ class TestCreateUserJob:
"whereisjane?",
] == jmespath.search("spec.template.spec.containers[0].args", docs[0])
+ def test_no_airflow_local_settings(self):
+ docs = render_chart(
+ values={"airflowLocalSettings": None},
show_only=["templates/jobs/create-user-job.yaml"]
+ )
+ volume_mounts =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert "airflow_local_settings.py" not in str(volume_mounts)
+
+ def test_airflow_local_settings(self):
+ docs = render_chart(
+ values={"airflowLocalSettings": "# Well hello!"},
+ show_only=["templates/jobs/create-user-job.yaml"],
+ )
+ assert {
+ "name": "config",
+ "mountPath": "/opt/airflow/config/airflow_local_settings.py",
+ "subPath": "airflow_local_settings.py",
+ "readOnly": True,
+ } in jmespath.search("spec.template.spec.containers[0].volumeMounts",
docs[0])
+
class TestCreateUserJobServiceAccount:
def test_should_add_component_specific_labels(self):
diff --git a/tests/charts/test_dag_processor.py
b/tests/charts/test_dag_processor.py
index 06967f814d..1e84480cd5 100644
--- a/tests/charts/test_dag_processor.py
+++ b/tests/charts/test_dag_processor.py
@@ -497,3 +497,27 @@ class TestDagProcessor:
assert "git-sync-init" not in [
c["name"] for c in
jmespath.search("spec.template.spec.initContainers", docs[0])
]
+
+ def test_no_airflow_local_settings(self):
+ docs = render_chart(
+ values={"dagProcessor": {"enabled": True}, "airflowLocalSettings":
None},
+
show_only=["templates/dag-processor/dag-processor-deployment.yaml"],
+ )
+ volume_mounts =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert "airflow_local_settings.py" not in str(volume_mounts)
+ volume_mounts_init =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert "airflow_local_settings.py" not in str(volume_mounts_init)
+
+ def test_airflow_local_settings(self):
+ docs = render_chart(
+ values={"dagProcessor": {"enabled": True}, "airflowLocalSettings":
"# Well hello!"},
+
show_only=["templates/dag-processor/dag-processor-deployment.yaml"],
+ )
+ volume_mount = {
+ "name": "config",
+ "mountPath": "/opt/airflow/config/airflow_local_settings.py",
+ "subPath": "airflow_local_settings.py",
+ "readOnly": True,
+ }
+ assert volume_mount in
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert volume_mount in
jmespath.search("spec.template.spec.initContainers[0].volumeMounts", docs[0])
diff --git a/tests/charts/test_flower.py b/tests/charts/test_flower.py
index 321e3e1614..47e560a330 100644
--- a/tests/charts/test_flower.py
+++ b/tests/charts/test_flower.py
@@ -297,6 +297,27 @@ class TestFlowerDeployment:
assert "test_label" in
jmespath.search("spec.template.metadata.labels", docs[0])
assert jmespath.search("spec.template.metadata.labels",
docs[0])["test_label"] == "test_label_value"
+ def test_no_airflow_local_settings(self):
+ docs = render_chart(
+ values={"flower": {"enabled": True}, "airflowLocalSettings": None},
+ show_only=["templates/flower/flower-deployment.yaml"],
+ )
+ volume_mounts =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert "airflow_local_settings.py" not in str(volume_mounts)
+
+ def test_airflow_local_settings(self):
+ docs = render_chart(
+ values={"flower": {"enabled": True}, "airflowLocalSettings": "#
Well hello!"},
+ show_only=["templates/flower/flower-deployment.yaml"],
+ )
+ volume_mount = {
+ "name": "config",
+ "mountPath": "/opt/airflow/config/airflow_local_settings.py",
+ "subPath": "airflow_local_settings.py",
+ "readOnly": True,
+ }
+ assert volume_mount in
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+
class TestFlowerService:
@pytest.mark.parametrize(
diff --git a/tests/charts/test_migrate_database_job.py
b/tests/charts/test_migrate_database_job.py
index 69ecb858ea..9155954f60 100644
--- a/tests/charts/test_migrate_database_job.py
+++ b/tests/charts/test_migrate_database_job.py
@@ -262,3 +262,22 @@ class TestMigrateDatabaseJob:
assert ["release-name"] ==
jmespath.search("spec.template.spec.containers[0].command", docs[0])
assert ["Helm"] ==
jmespath.search("spec.template.spec.containers[0].args", docs[0])
+
+ def test_no_airflow_local_settings(self):
+ docs = render_chart(
+ values={"airflowLocalSettings": None},
show_only=["templates/jobs/migrate-database-job.yaml"]
+ )
+ volume_mounts =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert "airflow_local_settings.py" not in str(volume_mounts)
+
+ def test_airflow_local_settings(self):
+ docs = render_chart(
+ values={"airflowLocalSettings": "# Well hello!"},
+ show_only=["templates/jobs/migrate-database-job.yaml"],
+ )
+ assert {
+ "name": "config",
+ "mountPath": "/opt/airflow/config/airflow_local_settings.py",
+ "subPath": "airflow_local_settings.py",
+ "readOnly": True,
+ } in jmespath.search("spec.template.spec.containers[0].volumeMounts",
docs[0])
diff --git a/tests/charts/test_scheduler.py b/tests/charts/test_scheduler.py
index 0f36f708d1..3c456b862c 100644
--- a/tests/charts/test_scheduler.py
+++ b/tests/charts/test_scheduler.py
@@ -394,18 +394,22 @@ class TestScheduler:
)
volume_mounts =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
assert "airflow_local_settings.py" not in str(volume_mounts)
+ volume_mounts_init =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert "airflow_local_settings.py" not in str(volume_mounts_init)
def test_airflow_local_settings(self):
docs = render_chart(
values={"airflowLocalSettings": "# Well hello!"},
show_only=["templates/scheduler/scheduler-deployment.yaml"],
)
- assert {
+ volume_mount = {
"name": "config",
"mountPath": "/opt/airflow/config/airflow_local_settings.py",
"subPath": "airflow_local_settings.py",
"readOnly": True,
- } in jmespath.search("spec.template.spec.containers[0].volumeMounts",
docs[0])
+ }
+ assert volume_mount in
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert volume_mount in
jmespath.search("spec.template.spec.initContainers[0].volumeMounts", docs[0])
@pytest.mark.parametrize(
"executor, persistence, update_strategy, expected_update_strategy",
diff --git a/tests/charts/test_triggerer.py b/tests/charts/test_triggerer.py
index 42cbddc951..5921d4e4ec 100644
--- a/tests/charts/test_triggerer.py
+++ b/tests/charts/test_triggerer.py
@@ -470,6 +470,29 @@ class TestTriggerer:
c["name"] for c in
jmespath.search("spec.template.spec.initContainers", docs[0])
]
+ def test_no_airflow_local_settings(self):
+ docs = render_chart(
+ values={"airflowLocalSettings": None},
show_only=["templates/triggerer/triggerer-deployment.yaml"]
+ )
+ volume_mounts =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert "airflow_local_settings.py" not in str(volume_mounts)
+ volume_mounts_init =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert "airflow_local_settings.py" not in str(volume_mounts_init)
+
+ def test_airflow_local_settings(self):
+ docs = render_chart(
+ values={"airflowLocalSettings": "# Well hello!"},
+ show_only=["templates/triggerer/triggerer-deployment.yaml"],
+ )
+ volume_mount = {
+ "name": "config",
+ "mountPath": "/opt/airflow/config/airflow_local_settings.py",
+ "subPath": "airflow_local_settings.py",
+ "readOnly": True,
+ }
+ assert volume_mount in
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert volume_mount in
jmespath.search("spec.template.spec.initContainers[0].volumeMounts", docs[0])
+
class TestTriggererServiceAccount:
def test_should_add_component_specific_labels(self):
diff --git a/tests/charts/test_webserver.py b/tests/charts/test_webserver.py
index d5f70d3d46..dbe8a80dd9 100644
--- a/tests/charts/test_webserver.py
+++ b/tests/charts/test_webserver.py
@@ -519,18 +519,22 @@ class TestWebserverDeployment:
)
volume_mounts =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
assert "airflow_local_settings.py" not in str(volume_mounts)
+ volume_mounts_init =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert "airflow_local_settings.py" not in str(volume_mounts_init)
def test_airflow_local_settings(self):
docs = render_chart(
values={"airflowLocalSettings": "# Well hello!"},
show_only=["templates/webserver/webserver-deployment.yaml"],
)
- assert {
+ volume_mount = {
"name": "config",
"mountPath": "/opt/airflow/config/airflow_local_settings.py",
"subPath": "airflow_local_settings.py",
"readOnly": True,
- } in jmespath.search("spec.template.spec.containers[0].volumeMounts",
docs[0])
+ }
+ assert volume_mount in
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert volume_mount in
jmespath.search("spec.template.spec.initContainers[0].volumeMounts", docs[0])
def test_default_command_and_args(self):
docs =
render_chart(show_only=["templates/webserver/webserver-deployment.yaml"])
diff --git a/tests/charts/test_worker.py b/tests/charts/test_worker.py
index c7c9acc3fc..1838727072 100644
--- a/tests/charts/test_worker.py
+++ b/tests/charts/test_worker.py
@@ -451,18 +451,22 @@ class TestWorker:
)
volume_mounts =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
assert "airflow_local_settings.py" not in str(volume_mounts)
+ volume_mounts_init =
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert "airflow_local_settings.py" not in str(volume_mounts_init)
def test_airflow_local_settings(self):
docs = render_chart(
values={"airflowLocalSettings": "# Well hello!"},
show_only=["templates/workers/worker-deployment.yaml"],
)
- assert {
+ volume_mount = {
"name": "config",
"mountPath": "/opt/airflow/config/airflow_local_settings.py",
"subPath": "airflow_local_settings.py",
"readOnly": True,
- } in jmespath.search("spec.template.spec.containers[0].volumeMounts",
docs[0])
+ }
+ assert volume_mount in
jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])
+ assert volume_mount in
jmespath.search("spec.template.spec.initContainers[0].volumeMounts", docs[0])
def test_airflow_local_settings_kerberos_sidecar(self):
docs = render_chart(