Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIRFLOW-20533: add airflow.cfg as volumeMounts on initContainer wait-… #20609

Merged
merged 9 commits into from
Jan 19, 2022
5 changes: 5 additions & 0 deletions chart/templates/scheduler/scheduler-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ spec:
{{ toYaml .Values.scheduler.resources | indent 12 }}
image: {{ template "airflow_image_for_migrations" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
- name: config
mountPath: {{ template "airflow_config_path" . }}
subPath: airflow.cfg
readOnly: true
args:
{{- include "wait-for-migrations-command" . | indent 10 }}
envFrom:
Expand Down
5 changes: 5 additions & 0 deletions chart/templates/triggerer/triggerer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ spec:
{{- toYaml .Values.triggerer.resources | nindent 12 }}
image: {{ template "airflow_image_for_migrations" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
- name: config
mountPath: {{ template "airflow_config_path" . }}
subPath: airflow.cfg
readOnly: true
args:
{{- include "wait-for-migrations-command" . | nindent 10 }}
envFrom:
Expand Down
5 changes: 5 additions & 0 deletions chart/templates/webserver/webserver-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ spec:
{{ toYaml .Values.webserver.resources | indent 12 }}
image: {{ template "airflow_image_for_migrations" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
- name: config
mountPath: {{ template "airflow_config_path" . }}
subPath: airflow.cfg
readOnly: true
args:
{{- include "wait-for-migrations-command" . | indent 10 }}
envFrom:
Expand Down
5 changes: 5 additions & 0 deletions chart/templates/workers/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ spec:
{{ toYaml .Values.workers.resources | indent 12 }}
image: {{ template "airflow_image_for_migrations" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
- name: config
mountPath: {{ template "airflow_config_path" . }}
subPath: airflow.cfg
readOnly: true
args:
{{- include "wait-for-migrations-command" . | indent 10 }}
envFrom:
Expand Down
20 changes: 20 additions & 0 deletions chart/tests/test_airflow_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,23 @@ def test_have_all_variables(self):
assert variables == jmespath.search(
"spec.template.spec.containers[0].env[*].name", doc
), f"Wrong vars in {component}"

def test_have_all_config_mounts_on_init_containers(self):
docs = render_chart(
values={},
show_only=[
"templates/scheduler/scheduler-deployment.yaml",
"templates/workers/worker-deployment.yaml",
"templates/webserver/webserver-deployment.yaml",
"templates/triggerer/triggerer-deployment.yaml",
],
)
assert 4 == len(docs)
expected_mount = {
"subPath": "airflow.cfg",
"name": "config",
"readOnly": True,
"mountPath": "/opt/airflow"
demetthyl marked this conversation as resolved.
Show resolved Hide resolved
}
for doc in docs:
assert expected_mount in jmespath.search("spec.template.spec.initContainers[0].volumeMounts", doc)