diff --git a/chart/templates/_helpers.yaml b/chart/templates/_helpers.yaml index 898924f2ff930..833d6e2072d22 100644 --- a/chart/templates/_helpers.yaml +++ b/chart/templates/_helpers.yaml @@ -268,7 +268,7 @@ log_connections = {{ .Values.pgbouncer.logConnections }} {{- end -}} {{ define "airflow_dags_volume_claim" -}} -{{- if and .Values.dags.persistence.enabled .Values.dags.persistence.existingClaim -}} +{{- if .Values.dags.persistence.existingClaim -}} {{ .Values.dags.persistence.existingClaim }} {{- else -}} {{ .Release.Name }}-dags diff --git a/chart/templates/configmap.yaml b/chart/templates/configmap.yaml index 229399c4f59f5..1b876d69332fd 100644 --- a/chart/templates/configmap.yaml +++ b/chart/templates/configmap.yaml @@ -101,7 +101,7 @@ data: git_dags_folder_mount_point = {{ include "airflow_dags_mount_path" . }} dags_volume_mount_point = {{ include "airflow_dags_mount_path" . }} {{- if .Values.dags.persistence.enabled }} - dags_volume_claim = {{ .Release.Name }}-dags + dags_volume_claim = {{ include "airflow_dags_volume_claim" . }} dags_volume_subpath = {{.Values.dags.gitSync.dest }}/{{ .Values.dags.gitSync.subPath }} {{- else }} git_repo = {{ .Values.dags.gitSync.repo }} diff --git a/chart/templates/webserver/webserver-deployment.yaml b/chart/templates/webserver/webserver-deployment.yaml index 9ea2bc11826f2..fe7dee5ee6b88 100644 --- a/chart/templates/webserver/webserver-deployment.yaml +++ b/chart/templates/webserver/webserver-deployment.yaml @@ -145,7 +145,7 @@ spec: {{- if .Values.dags.persistence.enabled }} - name: dags persistentVolumeClaim: - claimName: {{ .Release.Name }}-dags + claimName: {{ template "airflow_dags_volume_claim" . }} {{- else if .Values.dags.gitSync.enabled }} - name: dags emptyDir: {} diff --git a/chart/tests/git-sync-scheduler_test.yaml b/chart/tests/git-sync-scheduler_test.yaml index 10d2288ed4876..a278cb89e53f2 100644 --- a/chart/tests/git-sync-scheduler_test.yaml +++ b/chart/tests/git-sync-scheduler_test.yaml @@ -133,3 +133,16 @@ tests: secretKeyRef: name: user-pass-secret key: GIT_SYNC_PASSWORD + - it: should set the volume claim correctly when using an existing claim + set: + dags: + persistence: + enabled: true + existingClaim: test-claim + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: dags + persistentVolumeClaim: + claimName: test-claim