feat(common): add upgrade and install specific initContainers

This commit is contained in:
kjeld Schouten-Lebbing
2022-01-23 15:11:09 +01:00
parent f0ded77cb5
commit 04a3aa9540
3 changed files with 33 additions and 1 deletions

View File

@@ -15,4 +15,4 @@ maintainers:
name: common
sources: null
type: library
version: 8.13.5
version: 8.14.0

View File

@@ -63,6 +63,32 @@ initContainers:
{{- end }}
{{- tpl (toYaml $initContainers) $ | nindent 2 }}
{{- end }}
{{- if .Release.IsInstall }}
{{- if .Values.installContainers }}
{{- $initContainers := list }}
{{- range $index, $key := (keys .Values.initContainers | uniq | sortAlpha) }}
{{- $container := get $.Values.initContainers $key }}
{{- if not $container.name -}}
{{- $_ := set $container "name" $key }}
{{- end }}
{{- $initContainers = append $initContainers $container }}
{{- end }}
{{- tpl (toYaml $initContainers) $ | nindent 2 }}
{{- end }}
{{- end }}
{{- if .Release.IsUpgrade }}
{{- if .Values.upgradeContainers }}
{{- $initContainers := list }}
{{- range $index, $key := (keys .Values.initContainers | uniq | sortAlpha) }}
{{- $container := get $.Values.initContainers $key }}
{{- if not $container.name -}}
{{- $_ := set $container "name" $key }}
{{- end }}
{{- $initContainers = append $initContainers $container }}
{{- end }}
{{- tpl (toYaml $initContainers) $ | nindent 2 }}
{{- end }}
{{- end }}
containers:
{{- include "common.controller.mainContainer" . | nindent 2 }}
{{- with .Values.additionalContainers }}

View File

@@ -334,6 +334,12 @@ securityContext:
# -- Configure the lifecycle for the main container
lifecycle: {}
# -- These containers will be run, as an initcontainer, a single time at install only.
installContainers: {}
# -- These containers will be run, as an initcontainer, a single time at each edit or update of the chart.
upgradeContainers: {}
# -- Specify any initContainers here as dictionary items. Each initContainer should have its own key.
# The dictionary item key will determine the order. Helm templates can be used.
initContainers: {}