Skip to content

feat(helm): add extraConfigsFiles support for file-based ConfigMap injection #34063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions helm/superset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ On helm this can be set on `extraSecretEnv.SUPERSET_SECRET_KEY` or `configOverri
| envFromSecrets | list | `[]` | This can be a list of templated strings |
| extraConfigMountPath | string | `"/app/configs"` | |
| extraConfigs | object | `{}` | Extra files to be mounted as ConfigMap on the path specified in `extraConfigMountPath` |
| extraConfigsFiles | object | `{}` | Same as above but the values are files |
| extraEnv | object | `{}` | Extra environment variables that will be passed into pods |
| extraEnvRaw | list | `[]` | Extra environment variables in RAW format that will be passed into pods |
| extraLabels | object | `{}` | Labels to be added to all resources |
Expand Down
24 changes: 23 additions & 1 deletion helm/superset/templates/configmap-superset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

*/}}

{{- if and .Values.extraConfigsFiles .Values.extraConfigs }}
{{ fail "❌ Cannot use both extraConfigs and extraConfigsFiles at the same time. Please set only one." }}
{{- end }}

{{- if .Values.extraConfigs }}
apiVersion: v1
kind: ConfigMap
Expand All @@ -36,4 +40,22 @@ data:
{{ $path }}: |
{{- tpl $config $ | nindent 4 -}}
{{- end -}}
{{- end -}}
{{- end }}

{{- if .Values.extraConfigsFiles }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "superset.fullname" . }}-extra-config
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "superset.name" . }}
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
{{- range $filename, $filepath := .Values.extraConfigsFiles }}
{{ $filename }}: |
{{- $.Files.Get $filepath | nindent 4 }}
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions helm/superset/templates/deployment-beat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ spec:
checksum/superset_bootstrap.sh: {{ tpl .Values.bootstrapScript . | sha256sum }}
checksum/connections: {{ .Values.supersetNode.connections | toYaml | sha256sum }}
checksum/extraConfigs: {{ .Values.extraConfigs | toYaml | sha256sum }}
checksum/extraConfigsFiles: {{ .Values.extraConfigsFiles | toYaml | sha256sum }}
checksum/extraSecrets: {{ .Values.extraSecrets | toYaml | sha256sum }}
checksum/extraSecretEnv: {{ .Values.extraSecretEnv | toYaml | sha256sum }}
checksum/configOverrides: {{ .Values.configOverrides | toYaml | sha256sum }}
Expand Down
5 changes: 3 additions & 2 deletions helm/superset/templates/deployment-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ spec:
checksum/superset_bootstrap.sh: {{ tpl .Values.bootstrapScript . | sha256sum }}
checksum/connections: {{ .Values.supersetNode.connections | toYaml | sha256sum }}
checksum/extraConfigs: {{ .Values.extraConfigs | toYaml | sha256sum }}
checksum/extraConfigsFiles: {{ .Values.extraConfigsFiles | toYaml | sha256sum }}
checksum/extraSecrets: {{ .Values.extraSecrets | toYaml | sha256sum }}
checksum/extraSecretEnv: {{ .Values.extraSecretEnv | toYaml | sha256sum }}
checksum/configOverrides: {{ .Values.configOverrides | toYaml | sha256sum }}
Expand Down Expand Up @@ -117,7 +118,7 @@ spec:
- name: superset-config
mountPath: {{ .Values.configMountPath | quote }}
readOnly: true
{{- if .Values.extraConfigs }}
{{- if or .Values.extraConfigs .Values.extraConfigsFiles }}
- name: superset-extra-config
mountPath: {{ .Values.extraConfigMountPath | quote }}
readOnly: true
Expand Down Expand Up @@ -177,7 +178,7 @@ spec:
- name: superset-config
secret:
secretName: {{ tpl .Values.configFromSecret . }}
{{- if .Values.extraConfigs }}
{{- if or .Values.extraConfigs .Values.extraConfigsFiles }}
- name: superset-extra-config
configMap:
name: {{ template "superset.fullname" . }}-extra-config
Expand Down
5 changes: 3 additions & 2 deletions helm/superset/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ spec:
checksum/superset_bootstrap.sh: {{ tpl .Values.bootstrapScript . | sha256sum }}
checksum/connections: {{ .Values.supersetNode.connections | toYaml | sha256sum }}
checksum/extraConfigs: {{ .Values.extraConfigs | toYaml | sha256sum }}
checksum/extraConfigsFiles: {{ .Values.extraConfigsFiles | toYaml | sha256sum }}
checksum/extraSecrets: {{ .Values.extraSecrets | toYaml | sha256sum }}
checksum/extraSecretEnv: {{ .Values.extraSecretEnv | toYaml | sha256sum }}
checksum/configOverrides: {{ .Values.configOverrides | toYaml | sha256sum }}
Expand Down Expand Up @@ -123,7 +124,7 @@ spec:
- name: superset-config
mountPath: {{ .Values.configMountPath | quote }}
readOnly: true
{{- if .Values.extraConfigs }}
{{- if or .Values.extraConfigs .Values.extraConfigsFiles }}
- name: superset-extra-config
mountPath: {{ .Values.extraConfigMountPath | quote }}
readOnly: true
Expand Down Expand Up @@ -187,7 +188,7 @@ spec:
- name: superset-config
secret:
secretName: {{ tpl .Values.configFromSecret . }}
{{- if .Values.extraConfigs }}
{{- if or .Values.extraConfigs .Values.extraConfigsFiles }}
- name: superset-extra-config
configMap:
name: {{ template "superset.fullname" . }}-extra-config
Expand Down
2 changes: 2 additions & 0 deletions helm/superset/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ extraConfigs: {}
# }"
# sqlalchemy_uri: example://example-db.local
# tables: []
extraConfigsFiles: {}
# import_datasources.yaml: files/import_datasources.yaml

# -- Extra files to be mounted as Secrets on the path specified in `configMountPath`
extraSecrets: {}
Expand Down
Loading