Skip to content

Commit

Permalink
feat: Environment variables from ConfigMap
Browse files Browse the repository at this point in the history
resolves #724
  • Loading branch information
mikutas committed Apr 4, 2023
1 parent 2c4cd3a commit f549fa4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,16 @@ Inject extra environment populated by secrets, if populated
{{- end -}}
{{- end -}}

{{- define "vault.extraEnvironmentVarsFromConfigMap" -}}
{{- if .extraEnvironmentVarsFromConfigMap -}}
envFrom:
{{- range .extraEnvironmentVarsFromConfigMap }}
- configMapRef:
name: {{ . }}
{{- end -}}
{{- end -}}
{{- end -}}

{{/* Scheme for health check and local endpoint */}}
{{- define "vault.scheme" -}}
{{- if .Values.global.tlsDisable -}}
Expand Down
1 change: 1 addition & 0 deletions templates/server-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ spec:
{{ template "vault.envs" . }}
{{- include "vault.extraEnvironmentVars" .Values.server | nindent 12 }}
{{- include "vault.extraSecretEnvironmentVars" .Values.server | nindent 12 }}
{{- include "vault.extraEnvironmentVarsFromConfigMap" .Values.server | nindent 10 }}
volumeMounts:
{{ template "vault.mounts" . }}
- name: home
Expand Down
3 changes: 3 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,9 @@
"extraSecretEnvironmentVars": {
"type": "array"
},
"extraEnvironmentVarsFromConfigMap": {
"type": "array"
},
"extraVolumes": {
"type": "array"
},
Expand Down
6 changes: 6 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,12 @@ server:
# secretName: vault
# secretKey: AWS_SECRET_ACCESS_KEY

# extraEnvironmentVarsFromConfigMap is a list of ConfigMap's name whose data as environment variables
# to set with the stateful set.
extraEnvironmentVarsFromConfigMap: []
# - my-configmap
# - my-configmap2

# Deprecated: please use 'volumes' instead.
# extraVolumes is a list of extra volumes to mount. These will be exposed
# to Vault in the path `/vault/userconfig/<name>/`. The value below is
Expand Down

0 comments on commit f549fa4

Please sign in to comment.