From 8b3d08aeedb89640c7b026beb7bcf45c8beb3a21 Mon Sep 17 00:00:00 2001 From: Max Voitko Date: Wed, 30 Jun 2021 04:34:45 +0300 Subject: [PATCH] feat: add env vars from multiple secrets in Helm chart (#15426) --- helm/superset/Chart.yaml | 2 +- helm/superset/templates/deployment-beat.yaml | 6 +++++- helm/superset/templates/deployment-worker.yaml | 6 +++++- helm/superset/templates/deployment.yaml | 6 +++++- helm/superset/templates/init-job.yaml | 6 +++++- helm/superset/values.yaml | 2 ++ 6 files changed, 23 insertions(+), 5 deletions(-) diff --git a/helm/superset/Chart.yaml b/helm/superset/Chart.yaml index 32d672fdd..72089dd8f 100644 --- a/helm/superset/Chart.yaml +++ b/helm/superset/Chart.yaml @@ -22,7 +22,7 @@ maintainers: - name: craig-rueda email: craig@craigrueda.com url: https://github.com/craig-rueda -version: 0.2.1 +version: 0.3.0 dependencies: - name: postgresql version: 10.2.0 diff --git a/helm/superset/templates/deployment-beat.yaml b/helm/superset/templates/deployment-beat.yaml index 0ec76da15..e5705fa08 100644 --- a/helm/superset/templates/deployment-beat.yaml +++ b/helm/superset/templates/deployment-beat.yaml @@ -69,7 +69,7 @@ spec: env: - name: "SUPERSET_PORT" value: {{ .Values.service.port | quote}} - {{ if .Values.extraEnv }} + {{- if .Values.extraEnv }} {{- range $key, $value := .Values.extraEnv }} - name: {{ $key | quote}} value: {{ $value | quote }} @@ -78,6 +78,10 @@ spec: envFrom: - secretRef: name: {{ tpl .Values.envFromSecret . | quote }} + {{- range .Values.envFromSecrets }} + - secretRef: + name: {{ tpl . $ | quote }} + {{- end }} volumeMounts: - name: superset-config mountPath: {{ .Values.configMountPath | quote }} diff --git a/helm/superset/templates/deployment-worker.yaml b/helm/superset/templates/deployment-worker.yaml index 11d4a7759..e9145b6c6 100644 --- a/helm/superset/templates/deployment-worker.yaml +++ b/helm/superset/templates/deployment-worker.yaml @@ -70,7 +70,7 @@ spec: env: - name: "SUPERSET_PORT" value: {{ .Values.service.port | quote}} - {{ if .Values.extraEnv }} + {{- if .Values.extraEnv }} {{- range $key, $value := .Values.extraEnv }} - name: {{ $key | quote}} value: {{ $value | quote }} @@ -79,6 +79,10 @@ spec: envFrom: - secretRef: name: {{ tpl .Values.envFromSecret . | quote }} + {{- range .Values.envFromSecrets }} + - secretRef: + name: {{ tpl . $ | quote }} + {{- end }} volumeMounts: - name: superset-config mountPath: {{ .Values.configMountPath | quote }} diff --git a/helm/superset/templates/deployment.yaml b/helm/superset/templates/deployment.yaml index 3ac7551b7..b750baeb1 100644 --- a/helm/superset/templates/deployment.yaml +++ b/helm/superset/templates/deployment.yaml @@ -73,7 +73,7 @@ spec: env: - name: "SUPERSET_PORT" value: {{ .Values.service.port | quote}} - {{ if .Values.extraEnv }} + {{- if .Values.extraEnv }} {{- range $key, $value := .Values.extraEnv }} - name: {{ $key | quote}} value: {{ $value | quote }} @@ -82,6 +82,10 @@ spec: envFrom: - secretRef: name: {{ tpl .Values.envFromSecret . | quote }} + {{- range .Values.envFromSecrets }} + - secretRef: + name: {{ tpl . $ | quote }} + {{- end }} volumeMounts: - name: superset-config mountPath: {{ .Values.configMountPath | quote }} diff --git a/helm/superset/templates/init-job.yaml b/helm/superset/templates/init-job.yaml index b3c4fd42f..45ab2235b 100644 --- a/helm/superset/templates/init-job.yaml +++ b/helm/superset/templates/init-job.yaml @@ -46,12 +46,16 @@ spec: envFrom: - secretRef: name: {{ tpl .Values.envFromSecret . }} + {{- range .Values.envFromSecrets }} + - secretRef: + name: {{ tpl . $ }} + {{- end }} imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: - name: superset-config mountPath: {{ .Values.configMountPath | quote }} readOnly: true - {{ if .Values.extraConfigs }} + {{- if .Values.extraConfigs }} - name: superset-extra-config mountPath: {{ .Values.extraConfigMountPath | quote }} readOnly: true diff --git a/helm/superset/values.yaml b/helm/superset/values.yaml index 4869efc47..fd859fecf 100644 --- a/helm/superset/values.yaml +++ b/helm/superset/values.yaml @@ -44,6 +44,8 @@ configFromSecret: '{{ template "superset.fullname" . }}-config' ## This can be useful for secret keys, etc. ## envFromSecret: '{{ template "superset.fullname" . }}-env' +## This can be a list of template strings +envFromSecrets: [] ## Extra environment variables that will be passed into pods ##