This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch v1-10-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 5ee07b9c44ac45b133c9a7910ff0a02c4af5b824 Author: Fernando Llaca <[email protected]> AuthorDate: Mon Oct 19 23:16:29 2020 +0200 Improvements for pod template file with git sync container (#11511) * 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 52b4733b8297c8a08210aead18c661a9d58f3f6c) --- chart/files/pod-template-file.kubernetes-helm-yaml | 6 ++--- chart/templates/_helpers.yaml | 8 +++++++ chart/tests/migrate-database-job_test.yaml | 27 ---------------------- chart/values.yaml | 4 ++++ 4 files changed, 15 insertions(+), 30 deletions(-) diff --git a/chart/files/pod-template-file.kubernetes-helm-yaml b/chart/files/pod-template-file.kubernetes-helm-yaml index b19edf1..2206c57 100644 --- a/chart/files/pod-template-file.kubernetes-helm-yaml +++ b/chart/files/pod-template-file.kubernetes-helm-yaml @@ -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: [] @@ -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: [] @@ -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 }} diff --git a/chart/templates/_helpers.yaml b/chart/templates/_helpers.yaml index 4f3e0a0..6dbdc04 100644 --- a/chart/templates/_helpers.yaml +++ b/chart/templates/_helpers.yaml @@ -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 }} @@ -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 }} diff --git a/chart/tests/migrate-database-job_test.yaml b/chart/tests/migrate-database-job_test.yaml deleted file mode 100644 index 117b7a7..0000000 --- a/chart/tests/migrate-database-job_test.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -templates: - - migrate-database-job.yaml -tests: - - it: should run by default - asserts: - - isKind: - of: Job - - equal: - path: spec.template.spec.containers[0].name - value: run-airflow-migrations diff --git a/chart/values.yaml b/chart/values.yaml index 7b609a6..1556341 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -123,6 +123,10 @@ images: repository: ~ tag: ~ pullPolicy: IfNotPresent + pod_template: + repository: ~ + tag: ~ + pullPolicy: IfNotPresent flower: repository: ~ tag: ~
