You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2020/11/15 02:52:00 UTC
[airflow] 17/32: Consistent use images in Helm Chart (#11701)
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 0df5e99b82e1de5fba72e77e20f5578809c7e6ad
Author: Kamil BreguĊa <mi...@users.noreply.github.com>
AuthorDate: Wed Oct 21 12:12:14 2020 +0200
Consistent use images in Helm Chart (#11701)
(cherry picked from commit 883eadfc1d13a16b662fd2b235917a8878c8e0f0)
---
chart/templates/_helpers.yaml | 7 +++-
.../templates/pgbouncer/pgbouncer-deployment.yaml | 5 +++
chart/templates/redis/redis-statefulset.yaml | 6 +++-
.../templates/scheduler/scheduler-deployment.yaml | 1 +
chart/templates/statsd/statsd-deployment.yaml | 6 +++-
chart/templates/workers/worker-deployment.yaml | 1 +
chart/tests/scheduler_test.yaml | 38 ----------------------
chart/tests/worker_test.yaml | 38 ----------------------
chart/values.schema.json | 26 ++++++++++-----
chart/values.yaml | 7 ++--
10 files changed, 45 insertions(+), 90 deletions(-)
diff --git a/chart/templates/_helpers.yaml b/chart/templates/_helpers.yaml
index 6dbdc04..beb26a7 100644
--- a/chart/templates/_helpers.yaml
+++ b/chart/templates/_helpers.yaml
@@ -104,7 +104,8 @@
{{/* Git sync container */}}
{{- define "git_sync_container"}}
- name: {{ .Values.dags.gitSync.containerName }}
- image: "{{ .Values.dags.gitSync.containerRepository }}:{{ .Values.dags.gitSync.containerTag }}"
+ image: {{ template "git_sync_image" . }}
+ imagePullPolicy: {{ .Values.images.gitSync.pullPolicy }}
securityContext:
runAsUser: {{ .Values.dags.gitSync.uid }}
env:
@@ -207,6 +208,10 @@
{{ printf "%s:%s" .Values.images.pgbouncerExporter.repository .Values.images.pgbouncerExporter.tag }}
{{- end }}
+{{ define "git_sync_image" -}}
+{{ printf "%s:%s" .Values.images.gitSync.repository .Values.images.gitSync.tag }}
+{{- end }}
+
{{ define "fernet_key_secret" -}}
{{ default (printf "%s-fernet-key" .Release.Name) .Values.fernetKeySecretName }}
{{- end }}
diff --git a/chart/templates/pgbouncer/pgbouncer-deployment.yaml b/chart/templates/pgbouncer/pgbouncer-deployment.yaml
index 9237e6c..18e1b21 100644
--- a/chart/templates/pgbouncer/pgbouncer-deployment.yaml
+++ b/chart/templates/pgbouncer/pgbouncer-deployment.yaml
@@ -63,6 +63,10 @@ spec:
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
restartPolicy: Always
+ {{- if or .Values.registry.secretName .Values.registry.connection }}
+ imagePullSecrets:
+ - name: {{ template "registry_secret" . }}
+ {{- end }}
containers:
- name: pgbouncer
image: {{ template "pgbouncer_image" . }}
@@ -117,6 +121,7 @@ spec:
command: ["/bin/sh", "-c", "killall -INT pgbouncer && sleep 120"]
- name: metrics-exporter
image: {{ template "pgbouncer_exporter_image" . }}
+ imagePullPolicy: {{ .Values.images.pgbouncerExporter.pullPolicy }}
env:
- name: DATABASE_URL
valueFrom:
diff --git a/chart/templates/redis/redis-statefulset.yaml b/chart/templates/redis/redis-statefulset.yaml
index 6cd7361..6df78b4 100644
--- a/chart/templates/redis/redis-statefulset.yaml
+++ b/chart/templates/redis/redis-statefulset.yaml
@@ -59,9 +59,13 @@ spec:
{{ toYaml .Values.affinity | indent 8 }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
+ {{- if or .Values.registry.secretName .Values.registry.connection }}
+ imagePullSecrets:
+ - name: {{ template "registry_secret" . }}
+ {{- end }}
containers:
- name: redis
- image: {{- include "redis_image" . | indent 1 }}
+ image: {{ template "redis_image" . }}
imagePullPolicy: {{ .Values.images.redis.pullPolicy }}
command: ["/bin/sh"]
resources:
diff --git a/chart/templates/scheduler/scheduler-deployment.yaml b/chart/templates/scheduler/scheduler-deployment.yaml
index 2cf3dce..1ed1c3a 100644
--- a/chart/templates/scheduler/scheduler-deployment.yaml
+++ b/chart/templates/scheduler/scheduler-deployment.yaml
@@ -168,6 +168,7 @@ spec:
# we don't have elasticsearch enabled.
- name: scheduler-logs
image: {{ template "airflow_image" . }}
+ imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
args: ["airflow", "serve_logs"]
ports:
- name: worker-logs
diff --git a/chart/templates/statsd/statsd-deployment.yaml b/chart/templates/statsd/statsd-deployment.yaml
index d7f5464..181c910 100644
--- a/chart/templates/statsd/statsd-deployment.yaml
+++ b/chart/templates/statsd/statsd-deployment.yaml
@@ -56,9 +56,13 @@ spec:
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
restartPolicy: Always
+ {{- if or .Values.registry.secretName .Values.registry.connection }}
+ imagePullSecrets:
+ - name: {{ template "registry_secret" . }}
+ {{- end }}
containers:
- name: statsd
- image: {{- include "statsd_image" . | indent 1 }}
+ image: {{ template "statsd_image" . }}
imagePullPolicy: {{ .Values.images.statsd.pullPolicy }}
args:
- "-statsd.mapping-config=/etc/statsd-exporter/mappings.yml"
diff --git a/chart/templates/workers/worker-deployment.yaml b/chart/templates/workers/worker-deployment.yaml
index 47aa18e..dc2dfb4 100644
--- a/chart/templates/workers/worker-deployment.yaml
+++ b/chart/templates/workers/worker-deployment.yaml
@@ -152,6 +152,7 @@ spec:
{{- if $persistence }}
- name: worker-gc
image: {{ template "airflow_image" . }}
+ imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
args: ["bash", "/clean-logs"]
volumeMounts:
- name: logs
diff --git a/chart/tests/scheduler_test.yaml b/chart/tests/scheduler_test.yaml
deleted file mode 100644
index 327b6e3..0000000
--- a/chart/tests/scheduler_test.yaml
+++ /dev/null
@@ -1,38 +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:
- - scheduler/scheduler-deployment.yaml
-tests:
- - it: should add extraVolume and extraVolumeMount
- set:
- executor: CeleryExecutor
- scheduler:
- extraVolumes:
- - name: test-volume
- emptyDir: {}
- extraVolumeMounts:
- - name: test-volume
- mountPath: /opt/test
- asserts:
- - equal:
- path: spec.template.spec.volumes[1].name
- value: test-volume
- - equal:
- path: spec.template.spec.containers[0].volumeMounts[3].name
- value: test-volume
diff --git a/chart/tests/worker_test.yaml b/chart/tests/worker_test.yaml
deleted file mode 100644
index 29c4b97..0000000
--- a/chart/tests/worker_test.yaml
+++ /dev/null
@@ -1,38 +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:
- - workers/worker-deployment.yaml
-tests:
- - it: should add extraVolume and extraVolumeMount
- set:
- executor: CeleryExecutor
- workers:
- extraVolumes:
- - name: test-volume
- emptyDir: {}
- extraVolumeMounts:
- - name: test-volume
- mountPath: /opt/test
- asserts:
- - equal:
- path: spec.template.spec.volumes[0].name
- value: test-volume
- - equal:
- path: spec.template.spec.containers[0].volumeMounts[0].name
- value: test-volume
diff --git a/chart/values.schema.json b/chart/values.schema.json
index b2f7288..7289374 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -288,6 +288,24 @@
"type": "string"
}
}
+ },
+ "gitSync": {
+ "description": "Configuration of the gitSync image.",
+ "type": "object",
+ "properties": {
+ "repository": {
+ "description": "The gitSync image repository.",
+ "type": "string"
+ },
+ "tag": {
+ "description": "The gitSync image tag.",
+ "type": "string"
+ },
+ "pullPolicy": {
+ "description": "The gitSync image pull policy.",
+ "type": "string"
+ }
+ }
}
}
},
@@ -1108,14 +1126,6 @@
"description": "Interval between git sync attempts in seconds.",
"type": "integer"
},
- "containerRepository": {
- "description": "Git sync image repository.",
- "type": "string"
- },
- "containerTag": {
- "description": "Git sync image tag.",
- "type": "string"
- },
"containerName": {
"description": "Git sync container name.",
"type": "string"
diff --git a/chart/values.yaml b/chart/values.yaml
index 1556341..b8bd0f8 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -147,6 +147,10 @@ images:
repository: apache/airflow
tag: airflow-pgbouncer-exporter-2020.09.25-0.5.0
pullPolicy: IfNotPresent
+ gitSync:
+ repository: k8s.gcr.io/git-sync
+ tag: v3.1.6
+ pullPolicy: IfNotPresent
# Environment variables for all airflow containers
env: []
@@ -734,8 +738,5 @@ dags:
# <host2>,<ip2> <key2>
# interval between git sync attempts in seconds
wait: 60
- # git sync image details
- containerRepository: k8s.gcr.io/git-sync
- containerTag: v3.1.6
containerName: git-sync
uid: 65533