From 265194e0a04b3593a41593fbb2bc84163ee8cdf3 Mon Sep 17 00:00:00 2001 From: Hayden Spitzley <105455169+hspitzley-czi@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:38:59 -0600 Subject: [PATCH] feat: allow specifying init container tag in Stack helm chart (#25) --- stack/templates/_helpers.tpl | 8 ++++++++ stack/templates/deployment.yaml | 2 ++ 2 files changed, 10 insertions(+) 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}}