Skip to content

Commit

Permalink
Merge pull request #661 from kyschouv/add_envfrom_secrets
Browse files Browse the repository at this point in the history
[grafana] Adding envFromSecrets to allow multiple optional secrets to provide environment variables
  • Loading branch information
zanhsieh committed Sep 7, 2021
2 parents e13e3b4 + 407fc58 commit 06d5d4a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 8 additions & 2 deletions charts/grafana/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -377,16 +377,22 @@ containers:
- name: "{{ tpl $key $ }}"
value: "{{ tpl (print $value) $ }}"
{{- end }}
{{- if .Values.envFromSecret }}
{{- if or .Values.envFromSecret (or .Values.envRenderSecret .Values.envFromSecrets) }}
envFrom:
{{- if .Values.envFromSecret }}
- secretRef:
name: {{ tpl .Values.envFromSecret . }}
{{- end }}
{{- if .Values.envRenderSecret }}
envFrom:
- secretRef:
name: {{ template "grafana.fullname" . }}-env
{{- end }}
{{- range .Values.envFromSecrets }}
- secretRef:
name: {{ .name }}
optional: {{ .optional | default false }}
{{- end }}
{{- end }}
livenessProbe:
{{ toYaml .Values.livenessProbe | indent 6 }}
readinessProbe:
Expand Down
6 changes: 6 additions & 0 deletions charts/grafana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ envFromSecret: ""
## This can be useful for auth tokens, etc
envRenderSecret: {}

## The names of secrets in the same kubernetes namespace which contain values to be added to the environment
## Each entry should contain a name key, and can optionally specify whether the secret must be defined with an optional key.
envFromSecrets: []
## - name: secret-name
## optional: true

# Inject Kubernetes services as environment variables.
# See https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#environment-variables
enableServiceLinks: true
Expand Down

0 comments on commit 06d5d4a

Please sign in to comment.