Skip to content

Commit

Permalink
Upd: Implementation for bokysan#71, tests for extraContainers
Browse files Browse the repository at this point in the history
  • Loading branch information
bokysan committed Jun 4, 2021
1 parent 3ec47a1 commit 18e96b8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
5 changes: 4 additions & 1 deletion helm/mail/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{{- $checksums := include (print $chart ".checksums") . -}}
{{- $serviceAccountName := include (print $chart ".serviceAccountName") . -}}
{{- $kind := "StatefulSet" -}}
{{- $root := . -}}
apiVersion: apps/v1
kind: {{ $kind | quote }}
metadata:
Expand All @@ -30,9 +31,11 @@ spec:
{{- $selectorLabels | nindent 8 }}
{{- with .Values.pod.labels }}{{ toYaml . | nindent 8 }}{{- end }}
annotations:
{{- if .Values.recreateOnRedeploy }}
# https://keel.sh/docs/#helm-same-tag-force-updates
# Current consensus on a best way to "force" update Helm releases is by modifying your pod spec template by adding:
date/deploy-date: {{ now | quote }}
{{- end }}
{{- $checksums | nindent 8 }}
{{- with .Values.pod.annotations }}{{ toYaml . | nindent 8 }}{{ end }}
spec:
Expand Down Expand Up @@ -92,7 +95,7 @@ spec:
{{- if .Values.extraVolumeMounts }}{{- toYaml .Values.extraVolumeMounts | nindent 12 }}{{ end }}
resources: {{ toYaml .Values.resources | nindent 12 }}
{{- if .Values.extraContainers }}
{{ tpl .Values.extraContainers . | indent 8 }}
{{- tpl .Values.extraContainers $root | nindent 8 }}
{{- end }}
volumes:
# Socket directories
Expand Down
10 changes: 10 additions & 0 deletions helm/mail/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ service:
annotations: {}
# nodePort:

# Tell helm to restart (recreate) pods on every deploy. Setting this to true will inject
# `date/deploy-date: <timestamp>` annotation into pod specification for StateFulset. This
# ensures that the Pod is recreated with the new changes.
#
# Feel free to disable this but doing so **IS IT YOUR OWN RISK**. By disabling this feature
# you might run into issues where some changes are not reflected on the Pod. If you experience
# this with this setting set to `false` the first thing to try out is to restart / delete
# a pod and let `StatefulSet` recreate it.
recreateOnRedeploy: true

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
Expand Down
6 changes: 6 additions & 0 deletions helm/test_8_extra_containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extraContainers: |
- name: {{ include (print "mail.fullname") . -}}-test
image: "ubuntu"
imagePullPolicy: "Always"
recreateOnRedeploy: false
File renamed without changes.

0 comments on commit 18e96b8

Please sign in to comment.