Skip to content

Commit f9165b4

Browse files
Your Nameaeroyorch
authored andcommitted
Add registry.secretNames and registry.connections options to Helm chart
1 parent f4846a8 commit f9165b4

20 files changed

+121
-64
lines changed

chart/docs/production-guide.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,12 +661,14 @@ flower Basic Auth using the ``_CMD`` or ``_SECRET`` variant without disabling th
661661
+-------------------------------------------------------+------------------------------------------+------------------------------------------------+
662662
| ``<RELEASE_NAME>-pgbouncer-certificates`` | | |
663663
+-------------------------------------------------------+------------------------------------------+------------------------------------------------+
664-
| ``<RELEASE_NAME>-registry`` | ``.Values.registry.secretName`` | |
665-
+-------------------------------------------------------+------------------------------------------+------------------------------------------------+
666664
| ``<RELEASE_NAME>-kerberos-keytab`` | | |
667665
+-------------------------------------------------------+------------------------------------------+------------------------------------------------+
668666
| ``<RELEASE_NAME>-flower`` | ``.Values.flower.secretName`` | ``AIRFLOW__CELERY__FLOWER_BASIC_AUTH`` |
669667
+-------------------------------------------------------+------------------------------------------+------------------------------------------------+
670668

669+
A secret named ``<RELEASE_NAME>-registry`` is also created when ``.Values.registry.connection`` is
670+
defined and neither ``.Values.registry.secretName`` nor ``.Values.imagePullSecrets`` is set. However,
671+
this behavior is deprecated in favor of explicitly defining ``.Values.imagePullSecrets``.
672+
671673
You can read more about advanced ways of setting configuration variables in the
672674
:doc:`apache-airflow:howto/set-config`.

chart/files/pod-template-file.kubernetes-helm-yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,7 @@ spec:
216216
{{- if .Values.workers.runtimeClassName }}
217217
runtimeClassName: {{ .Values.workers.runtimeClassName }}
218218
{{- end }}
219-
{{- if or .Values.registry.secretName .Values.registry.connection }}
220-
imagePullSecrets:
221-
- name: {{ template "registry_secret" . }}
222-
{{- end }}
219+
imagePullSecrets: {{- include "image_pull_secrets" . | nindent 4 }}
223220
{{- if .Values.workers.hostAliases }}
224221
hostAliases: {{- toYaml .Values.workers.hostAliases | nindent 4 }}
225222
{{- end }}

chart/templates/_helpers.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,20 @@ If release name contains chart name it will be used as a full name.
460460
{{- default (printf "%s-pgbouncer-stats" (include "airflow.fullname" .)) .Values.pgbouncer.metricsExporterSidecar.statsSecretName }}
461461
{{- end }}
462462

463-
{{- define "registry_secret" -}}
464-
{{- default (printf "%s-registry" (include "airflow.fullname" .)) .Values.registry.secretName }}
463+
{{- define "image_pull_secrets" -}}
464+
{{- $secrets := (default (list .Values.registry.secretName) .Values.imagePullSecrets) -}}
465+
{{- $secrets = ($secrets | compact | uniq) -}}
466+
{{- if and (not $secrets) (or .Values.registry.connection) -}}
467+
{{- $secrets = append $secrets (printf "%s-registry" (include "airflow.fullname" .)) -}}
468+
{{- end -}}
469+
{{- $out := list -}}
470+
{{- range $n := $secrets }}
471+
{{- if kindIs "string" $n }}
472+
{{- $n = dict "name" $n -}}
473+
{{- end -}}
474+
{{- $out = append $out (dict "name" $n.name) -}}
475+
{{- end -}}
476+
{{- toYaml $out -}}
465477
{{- end }}
466478

467479
{{- define "elasticsearch_secret" -}}

chart/templates/api-server/api-server-deployment.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,7 @@ spec:
122122
topologySpreadConstraints: {{- toYaml $topologySpreadConstraints | nindent 8 }}
123123
restartPolicy: Always
124124
securityContext: {{ $securityContext | nindent 8 }}
125-
{{- if or .Values.registry.secretName .Values.registry.connection }}
126-
imagePullSecrets:
127-
- name: {{ template "registry_secret" . }}
128-
{{- end }}
125+
imagePullSecrets: {{- include "image_pull_secrets" . | nindent 8 }}
129126
initContainers:
130127
{{- if .Values.apiServer.waitForMigrations.enabled }}
131128
- name: wait-for-airflow-migrations

chart/templates/cleanup/cleanup-cronjob.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ spec:
8686
tolerations: {{- toYaml $tolerations | nindent 12 }}
8787
topologySpreadConstraints: {{- toYaml $topologySpreadConstraints | nindent 12 }}
8888
serviceAccountName: {{ include "cleanup.serviceAccountName" . }}
89-
{{- if or .Values.registry.secretName .Values.registry.connection }}
90-
imagePullSecrets:
91-
- name: {{ template "registry_secret" . }}
92-
{{- end }}
89+
imagePullSecrets: {{- include "image_pull_secrets" . | nindent 12 }}
9390
securityContext: {{ $securityContext | nindent 12 }}
9491
containers:
9592
- name: airflow-cleanup-pods

chart/templates/dag-processor/dag-processor-deployment.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ spec:
116116
restartPolicy: Always
117117
serviceAccountName: {{ include "dagProcessor.serviceAccountName" . }}
118118
securityContext: {{ $securityContext | nindent 8 }}
119-
{{- if or .Values.registry.secretName .Values.registry.connection }}
120-
imagePullSecrets:
121-
- name: {{ template "registry_secret" . }}
122-
{{- end }}
119+
imagePullSecrets: {{ include "image_pull_secrets" . | nindent 8 }}
123120
initContainers:
124121
{{- if .Values.dagProcessor.waitForMigrations.enabled }}
125122
- name: wait-for-airflow-migrations

chart/templates/flower/flower-deployment.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ spec:
8585
{{- end }}
8686
restartPolicy: Always
8787
securityContext: {{ $securityContext | nindent 8 }}
88-
{{- if or .Values.registry.secretName .Values.registry.connection }}
89-
imagePullSecrets:
90-
- name: {{ template "registry_secret" . }}
91-
{{- end }}
88+
imagePullSecrets: {{- include "image_pull_secrets" . | nindent 8 }}
9289
containers:
9390
- name: flower
9491
image: {{ template "flower_image" . }}

chart/templates/jobs/create-user-job.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ spec:
8686
tolerations: {{- toYaml $tolerations | nindent 8 }}
8787
topologySpreadConstraints: {{- toYaml $topologySpreadConstraints | nindent 8 }}
8888
serviceAccountName: {{ include "createUserJob.serviceAccountName" . }}
89-
{{- if or .Values.registry.secretName .Values.registry.connection }}
90-
imagePullSecrets:
91-
- name: {{ template "registry_secret" . }}
92-
{{- end }}
89+
imagePullSecrets: {{- include "image_pull_secrets" . | nindent 8 }}
9390
{{- if .Values.createUserJob.extraInitContainers }}
9491
initContainers:
9592
{{- tpl (toYaml .Values.createUserJob.extraInitContainers) . | nindent 8 }}

chart/templates/jobs/migrate-database-job.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ spec:
8686
tolerations: {{- toYaml $tolerations | nindent 8 }}
8787
topologySpreadConstraints: {{- toYaml $topologySpreadConstraints | nindent 8 }}
8888
serviceAccountName: {{ include "migrateDatabaseJob.serviceAccountName" . }}
89-
{{- if or .Values.registry.secretName .Values.registry.connection }}
90-
imagePullSecrets:
91-
- name: {{ template "registry_secret" . }}
92-
{{- end }}
89+
imagePullSecrets: {{- include "image_pull_secrets" . | nindent 8 }}
9390
{{- if .Values.migrateDatabaseJob.extraInitContainers }}
9491
initContainers:
9592
{{- tpl (toYaml .Values.migrateDatabaseJob.extraInitContainers) . | nindent 8 }}

chart/templates/pgbouncer/pgbouncer-deployment.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ spec:
9090
serviceAccountName: {{ include "pgbouncer.serviceAccountName" . }}
9191
securityContext: {{ $securityContext | nindent 8 }}
9292
restartPolicy: Always
93-
{{- if or .Values.registry.secretName .Values.registry.connection }}
94-
imagePullSecrets:
95-
- name: {{ template "registry_secret" . }}
96-
{{- end }}
93+
imagePullSecrets: {{- include "image_pull_secrets" . | nindent 8 }}
9794
containers:
9895
- name: pgbouncer
9996
image: {{ template "pgbouncer_image" . }}

0 commit comments

Comments
 (0)