From 18e96b8e8d3c6abfcba360b92235a675f1ed79b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bojan=20=C4=8Cekrli=C4=87?= Date: Fri, 4 Jun 2021 16:16:42 +0200 Subject: [PATCH] Upd: Implementation for #71, tests for extraContainers --- helm/mail/templates/statefulset.yaml | 5 ++++- helm/mail/values.yaml | 10 ++++++++++ helm/test_8_extra_containers.yml | 6 ++++++ ...test_6_service_spec.yml => test_9_service_spec.yml} | 0 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 helm/test_8_extra_containers.yml rename helm/{test_6_service_spec.yml => test_9_service_spec.yml} (100%) diff --git a/helm/mail/templates/statefulset.yaml b/helm/mail/templates/statefulset.yaml index ccfb06d..cb4fe27 100644 --- a/helm/mail/templates/statefulset.yaml +++ b/helm/mail/templates/statefulset.yaml @@ -6,6 +6,7 @@ {{- $checksums := include (print $chart ".checksums") . -}} {{- $serviceAccountName := include (print $chart ".serviceAccountName") . -}} {{- $kind := "StatefulSet" -}} +{{- $root := . -}} apiVersion: apps/v1 kind: {{ $kind | quote }} metadata: @@ -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: @@ -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 diff --git a/helm/mail/values.yaml b/helm/mail/values.yaml index 593daf5..2fe6140 100644 --- a/helm/mail/values.yaml +++ b/helm/mail/values.yaml @@ -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: ` 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 diff --git a/helm/test_8_extra_containers.yml b/helm/test_8_extra_containers.yml new file mode 100644 index 0000000..28adde0 --- /dev/null +++ b/helm/test_8_extra_containers.yml @@ -0,0 +1,6 @@ +extraContainers: | + - name: {{ include (print "mail.fullname") . -}}-test + image: "ubuntu" + imagePullPolicy: "Always" + +recreateOnRedeploy: false diff --git a/helm/test_6_service_spec.yml b/helm/test_9_service_spec.yml similarity index 100% rename from helm/test_6_service_spec.yml rename to helm/test_9_service_spec.yml