Skip to content

Commit

Permalink
Improvements for pod template file with git sync container (#11511)
Browse files Browse the repository at this point in the history
* Helm chart fixes in pod template

- default pod_template image to `defaultAirflowRepository:defaultAirflowTag`
- fix never-ending git-sync init containers
- fix broken reference to volume

* Fix helm chart test

(cherry picked from commit 52b4733)
  • Loading branch information
fllaca authored and potiuk committed Nov 16, 2020
1 parent d95bb96 commit 9700fa3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 30 deletions.
6 changes: 3 additions & 3 deletions chart/files/pod-template-file.kubernetes-helm-yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ metadata:
spec:
{{- if .Values.dags.gitSync.enabled }}
initContainers:
{{- include "git_sync_container" . | indent 8 }}
{{- include "git_sync_container" (dict "Values" .Values "is_init" "true") | indent 8 }}
{{- end }}
containers:
- args: []
Expand All @@ -32,7 +32,7 @@ spec:
value: LocalExecutor
{{- include "standard_airflow_environment" . | indent 4 }}
envFrom: []
image: dummy_image
image: {{ template "pod_template_image" . }}
imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
name: base
ports: []
Expand All @@ -56,7 +56,7 @@ spec:
{{- end }}
{{- if or .Values.dags.gitSync.enabled .Values.dags.persistence.enabled }}
- mountPath: {{ include "airflow_dags_mount_path" . }}
name: airflow-dags
name: dags
readOnly: true
{{- if .Values.dags.persistence.enabled }}
subPath: {{.Values.dags.gitSync.dest }}/{{ .Values.dags.gitSync.subPath }}
Expand Down
8 changes: 8 additions & 0 deletions chart/templates/_helpers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@
value: {{ .Values.dags.gitSync.wait | quote }}
- name: GIT_SYNC_MAX_SYNC_FAILURES
value: {{ .Values.dags.gitSync.maxFailures | quote }}
{{- if .is_init }}
- name: GIT_SYNC_ONE_TIME
value: "true"
{{- end }}
volumeMounts:
- name: dags
mountPath: {{ .Values.dags.gitSync.root }}
Expand All @@ -174,6 +178,10 @@
{{ printf "%s:%s" (.Values.images.airflow.repository | default .Values.defaultAirflowRepository) (.Values.images.airflow.tag | default .Values.defaultAirflowTag) }}
{{- end }}

{{ define "pod_template_image" -}}
{{ printf "%s:%s" (.Values.images.pod_template.repository | default .Values.defaultAirflowRepository) (.Values.images.pod_template.tag | default .Values.defaultAirflowTag) }}
{{- end }}

# This helper is used for airflow containers that do not need the users code.
{{ define "default_airflow_image" -}}
{{ printf "%s:%s" .Values.defaultAirflowRepository .Values.defaultAirflowTag }}
Expand Down
27 changes: 0 additions & 27 deletions chart/tests/migrate-database-job_test.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ images:
repository: ~
tag: ~
pullPolicy: IfNotPresent
pod_template:
repository: ~
tag: ~
pullPolicy: IfNotPresent
flower:
repository: ~
tag: ~
Expand Down

0 comments on commit 9700fa3

Please sign in to comment.