Skip to content

Commit

Permalink
Update: Add the possibility to add a Secret to the chart
Browse files Browse the repository at this point in the history
  • Loading branch information
bokysan committed May 18, 2021
1 parent c6e9a2e commit 4677036
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
15 changes: 15 additions & 0 deletions helm/mail/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- $chart := "mail" -}}
{{- $fullName := include (print $chart ".fullname") . -}}
{{- $labels := include (print $chart ".labels") . -}}
{{- with .Values.secret }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $fullName }}
labels:
{{- $labels | nindent 4 }}
data:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | b64enc | quote }}
{{- end }}
{{ end }}
4 changes: 4 additions & 0 deletions helm/mail/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ spec:
envFrom:
- configMapRef:
name: {{ $fullName | quote }}
{{- with .Values.secret }}
- secretRef:
name: {{ $fullName | quote }}
{{- end }}
{{ with .Values.extraEnv }}env: {{- toYaml . | nindent 12 }}{{ end }}
volumeMounts:
- mountPath: /var/spool/postfix
Expand Down
4 changes: 4 additions & 0 deletions helm/mail/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ container:
postfix:
securityContext: {}

# Define data which should be stored in a Secret
# (and shared with the pod as environment variables)
# secret: {}

config:
general: {}
# e.g.
Expand Down
11 changes: 11 additions & 0 deletions helm/test_5_secret.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
autoscaling:
enabled: true
maxReplicas: 4

config:
general:
TZ: Europe/London
ALLOWED_SENDER_DOMAINS: example.org

secret:
Hello: "World"

0 comments on commit 4677036

Please sign in to comment.