Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions chart/templates/dag-processor/dag-processor-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ spec:
resources:
{{ toYaml .Values.dagProcessor.resources | nindent 12 }}
volumeMounts:
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.dagProcessor.extraVolumeMounts }}
{{ toYaml .Values.dagProcessor.extraVolumeMounts | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -195,6 +198,9 @@ spec:
{{- if and .Values.dags.gitSync.enabled .Values.dags.gitSync.sshKeySecret }}
{{- include "git_sync_ssh_key_volume" . | indent 8 }}
{{- end }}
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
{{- if .Values.dagProcessor.extraVolumes }}
{{- toYaml .Values.dagProcessor.extraVolumes | nindent 8 }}
{{- end }}
Expand Down
6 changes: 6 additions & 0 deletions chart/templates/flower/flower-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ spec:
{{ toYaml .Values.flower.resources | indent 12 }}
volumeMounts:
{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.flower.extraVolumeMounts }}
{{ toYaml .Values.flower.extraVolumeMounts | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -147,6 +150,9 @@ spec:
- name: config
configMap:
name: {{ template "airflow_config" . }}
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
{{- if .Values.flower.extraVolumes }}
{{ toYaml .Values.flower.extraVolumes | indent 8 }}
{{- end }}
Expand Down
6 changes: 6 additions & 0 deletions chart/templates/jobs/create-user-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ spec:
{{ toYaml .Values.createUserJob.resources | indent 12 }}
volumeMounts:
{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.createUserJob.extraVolumeMounts }}
{{ toYaml .Values.createUserJob.extraVolumeMounts | nindent 12 }}
{{- end }}
Expand All @@ -116,6 +119,9 @@ spec:
- name: config
configMap:
name: {{ template "airflow_config" . }}
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
{{- if .Values.createUserJob.extraVolumes }}
{{ toYaml .Values.createUserJob.extraVolumes | nindent 8 }}
{{- end }}
Expand Down
6 changes: 6 additions & 0 deletions chart/templates/jobs/migrate-database-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ spec:
{{ toYaml .Values.migrateDatabaseJob.resources | indent 12 }}
volumeMounts:
{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.migrateDatabaseJob.extraVolumeMounts }}
{{ toYaml .Values.migrateDatabaseJob.extraVolumeMounts | nindent 12 }}
{{- end }}
Expand All @@ -117,6 +120,9 @@ spec:
- name: config
configMap:
name: {{ template "airflow_config" . }}
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
{{- if .Values.migrateDatabaseJob.extraVolumes }}
{{ toYaml .Values.migrateDatabaseJob.extraVolumes | nindent 8 }}
{{- end }}
Expand Down
6 changes: 6 additions & 0 deletions chart/templates/pgbouncer/pgbouncer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ spec:
mountPath: /etc/pgbouncer/server.key
readOnly: true
{{- end }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.pgbouncer.extraVolumeMounts }}
{{ toYaml .Values.pgbouncer.extraVolumeMounts | indent 12 }}
{{- end }}
Expand Down Expand Up @@ -176,6 +179,9 @@ spec:
secret:
secretName: {{ template "pgbouncer_certificates_secret" . }}
{{- end }}
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
{{- if .Values.pgbouncer.extraVolumes }}
{{ toYaml .Values.pgbouncer.extraVolumes | indent 8 }}
{{- end }}
Expand Down
12 changes: 12 additions & 0 deletions chart/templates/scheduler/scheduler-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ spec:
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.scheduler.extraVolumeMounts }}
{{ toYaml .Values.scheduler.extraVolumeMounts | indent 12 }}
{{- end }}
Expand Down Expand Up @@ -213,6 +216,9 @@ spec:
{{- if and $localOrDagProcessorDisabled (or .Values.dags.persistence.enabled .Values.dags.gitSync.enabled) }}
{{- include "airflow_dags_mount" . | nindent 12 }}
{{- end }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.scheduler.extraVolumeMounts }}
{{ toYaml .Values.scheduler.extraVolumeMounts | indent 12 }}
{{- end }}
Expand All @@ -239,6 +245,9 @@ spec:
volumeMounts:
- name: logs
mountPath: {{ template "airflow_logs" . }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.scheduler.extraVolumeMounts }}
{{ toYaml .Values.scheduler.extraVolumeMounts | indent 12 }}
{{- end }}
Expand Down Expand Up @@ -271,6 +280,9 @@ spec:
{{- end }}
{{- end}}
{{- end }}
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
{{- if .Values.scheduler.extraVolumes }}
{{ toYaml .Values.scheduler.extraVolumes | indent 8 }}
{{- end }}
Expand Down
9 changes: 9 additions & 0 deletions chart/templates/triggerer/triggerer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ spec:
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.triggerer.extraVolumeMounts }}
{{ toYaml .Values.triggerer.extraVolumeMounts | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -153,6 +156,9 @@ spec:
resources:
{{ toYaml .Values.triggerer.resources | nindent 12 }}
volumeMounts:
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.triggerer.extraVolumeMounts }}
{{ toYaml .Values.triggerer.extraVolumeMounts | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -209,6 +215,9 @@ spec:
{{- include "git_sync_ssh_key_volume" . | indent 8 }}
{{- end }}
{{- end }}
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
{{- if .Values.triggerer.extraVolumes }}
{{- toYaml .Values.triggerer.extraVolumes | nindent 8 }}
{{- end }}
Expand Down
9 changes: 9 additions & 0 deletions chart/templates/webserver/webserver-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ spec:
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.webserver.extraVolumeMounts }}
{{ toYaml .Values.webserver.extraVolumeMounts | indent 12 }}
{{- end }}
Expand Down Expand Up @@ -182,6 +185,9 @@ spec:
- name: logs
mountPath: {{ template "airflow_logs" . }}
{{- end }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.webserver.extraVolumeMounts }}
{{ toYaml .Values.webserver.extraVolumeMounts | indent 12 }}
{{- end }}
Expand Down Expand Up @@ -255,6 +261,9 @@ spec:
persistentVolumeClaim:
claimName: {{ template "airflow_logs_volume_claim" . }}
{{- end }}
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
{{- if .Values.webserver.extraVolumes }}
{{ toYaml .Values.webserver.extraVolumes | indent 8 }}
{{- end }}
15 changes: 15 additions & 0 deletions chart/templates/workers/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ spec:
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
volumeMounts:
{{- include "airflow_config_mount" . | nindent 12 }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.workers.extraVolumeMounts }}
{{ toYaml .Values.workers.extraVolumeMounts | indent 12 }}
{{- end }}
Expand Down Expand Up @@ -201,6 +204,9 @@ spec:
- name: worker-logs
containerPort: {{ .Values.ports.workerLogs }}
volumeMounts:
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.workers.extraVolumeMounts }}
{{ toYaml .Values.workers.extraVolumeMounts | indent 12 }}
{{- end }}
Expand Down Expand Up @@ -260,6 +266,9 @@ spec:
volumeMounts:
- name: logs
mountPath: {{ template "airflow_logs" . }}
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.workers.extraVolumeMounts }}
{{ toYaml .Values.workers.extraVolumeMounts | indent 12 }}
{{- end }}
Expand Down Expand Up @@ -289,6 +298,9 @@ spec:
- name: kerberos-ccache
mountPath: {{ .Values.kerberos.ccacheMountPath | quote }}
readOnly: false
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.workers.extraVolumeMounts }}
{{ toYaml .Values.workers.extraVolumeMounts | indent 12 }}
{{- end }}
Expand All @@ -309,6 +321,9 @@ spec:
{{- toYaml .Values.workers.extraContainers | nindent 8 }}
{{- end }}
volumes:
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
{{- if .Values.workers.extraVolumes }}
{{ toYaml .Values.workers.extraVolumes | indent 8 }}
{{- end }}
Expand Down
18 changes: 18 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,24 @@
}
]
},
"volumes": {
"description": "Volumes for all Airflow containers.",
"x-docsSection": "Airflow",
"type": "array",
"default": [],
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.Volume"
}
},
"volumeMounts": {
"description": "VolumeMounts for all Airflow containers.",
"x-docsSection": "Airflow",
"type": "array",
"default": [],
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.VolumeMount"
}
},
"secret": {
"description": "Secrets for all Airflow containers.",
"type": "array",
Expand Down
6 changes: 6 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ env: []
# - name: ""
# value: ""

# Volumes for all airflow containers
volumes: []

# VolumeMounts for all airflow containers
volumeMounts: []

# Secrets for all airflow containers
secret: []
# - envName: ""
Expand Down
16 changes: 16 additions & 0 deletions tests/charts/test_create_user_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,22 @@ def test_should_add_extra_volume_mounts(self):
"spec.template.spec.containers[0].volumeMounts[-1]", docs[0]
)

def test_should_add_global_volume_and_global_volume_mount(self):
docs = render_chart(
values={
"volumes": [{"name": "myvolume", "emptyDir": {}}],
"volumeMounts": [{"name": "foobar", "mountPath": "foo/bar"}],
},
show_only=["templates/jobs/create-user-job.yaml"],
)

assert {"name": "myvolume", "emptyDir": {}} == jmespath.search(
"spec.template.spec.volumes[-1]", docs[0]
)
assert {"name": "foobar", "mountPath": "foo/bar"} == jmespath.search(
"spec.template.spec.containers[0].volumeMounts[-1]", docs[0]
)

def test_should_add_extraEnvs(self):
docs = render_chart(
values={
Expand Down
15 changes: 15 additions & 0 deletions tests/charts/test_dag_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,21 @@ def test_should_add_extra_volume_and_extra_volume_mount(self):
"spec.template.spec.containers[0].volumeMounts[0].name", docs[0]
)

def test_should_add_global_volume_and_global_volume_mount(self):
docs = render_chart(
values={
"dagProcessor": {"enabled": True},
"volumes": [{"name": "test-volume", "emptyDir": {}}],
"volumeMounts": [{"name": "test-volume", "mountPath": "/opt/test"}],
},
show_only=["templates/dag-processor/dag-processor-deployment.yaml"],
)

assert "test-volume" == jmespath.search("spec.template.spec.volumes[1].name", docs[0])
assert "test-volume" == jmespath.search(
"spec.template.spec.containers[0].volumeMounts[0].name", docs[0]
)

def test_should_add_extraEnvs(self):
docs = render_chart(
values={
Expand Down
17 changes: 17 additions & 0 deletions tests/charts/test_flower.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,23 @@ def test_should_add_extra_volume_and_extra_volume_mount(self):
"spec.template.spec.containers[0].volumeMounts", docs[0]
)

def test_should_add_global_volume_and_global_volume_mount(self):
docs = render_chart(
values={
"flower": {
"enabled": True,
},
"volumes": [{"name": "myvolume", "emptyDir": {}}],
"volumeMounts": [{"name": "myvolume", "mountPath": "/opt/test"}],
},
show_only=["templates/flower/flower-deployment.yaml"],
)

assert {"name": "myvolume", "emptyDir": {}} in jmespath.search("spec.template.spec.volumes", docs[0])
assert {"name": "myvolume", "mountPath": "/opt/test"} in jmespath.search(
"spec.template.spec.containers[0].volumeMounts", docs[0]
)

def test_should_add_extraEnvs(self):
docs = render_chart(
values={
Expand Down
16 changes: 16 additions & 0 deletions tests/charts/test_migrate_database_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,22 @@ def test_should_add_extra_volume_mounts(self):
"spec.template.spec.containers[0].volumeMounts[-1]", docs[0]
)

def test_should_add_global_volume_and_global_volume_mount(self):
docs = render_chart(
values={
"volumes": [{"name": "myvolume", "emptyDir": {}}],
"volumeMounts": [{"name": "foobar", "mountPath": "foo/bar"}],
},
show_only=["templates/jobs/migrate-database-job.yaml"],
)

assert {"name": "myvolume", "emptyDir": {}} == jmespath.search(
"spec.template.spec.volumes[-1]", docs[0]
)
assert {"name": "foobar", "mountPath": "foo/bar"} == jmespath.search(
"spec.template.spec.containers[0].volumeMounts[-1]", docs[0]
)

@pytest.mark.parametrize(
"airflow_version, expected_arg",
[
Expand Down
Loading