diff --git a/stack/templates/_helpers.tpl b/stack/templates/_helpers.tpl index de43696..463aad7 100644 --- a/stack/templates/_helpers.tpl +++ b/stack/templates/_helpers.tpl @@ -119,4 +119,12 @@ env: {{- else }} env: [] {{- end }} +{{- end }} + +{{- define "initContainer.image" -}} +{{- if typeIs "string" .Values.image }} +image: {{ .Values.image }} +{{ else }} +image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" +{{- end }} {{- end }} \ No newline at end of file diff --git a/stack/templates/deployment.yaml b/stack/templates/deployment.yaml index 12f0bb4..9d40c39 100644 --- a/stack/templates/deployment.yaml +++ b/stack/templates/deployment.yaml @@ -88,6 +88,8 @@ spec: {{- end }} initContainers: {{- range $i, $container := .Values.initContainers }} + {{- $imageDict := fromYaml (include "initContainer.image" (dict "Chart" $global.Chart "Values" $container)) }} + {{- $container = mergeOverwrite $container $imageDict }} {{- with omit $container "envFrom" }} - {{- toYaml . | nindent 10 }} {{- include "service.configuration" $service | nindent 10}}