From 9e7a39046db45c6201ca568149407bce4a9ae3a9 Mon Sep 17 00:00:00 2001 From: Lucas POUZAC Date: Mon, 13 Oct 2025 08:50:02 +0200 Subject: [PATCH 01/15] feat(cronjob): add image templating. --- application/templates/cronjob.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/templates/cronjob.yaml b/application/templates/cronjob.yaml index 9bb59e1d..1ad57fd4 100644 --- a/application/templates/cronjob.yaml +++ b/application/templates/cronjob.yaml @@ -78,10 +78,10 @@ spec: {{- $image := required (print "Undefined image repo for container '" $name "'") $job.image.repository }} {{- with $job.image.tag }} {{- $image = print $image ":" . }} {{- end }} {{- with $job.image.digest }} {{- $image = print $image "@" . }} {{- end }} - image: {{ $image }} + image: {{ tpl $image $ }} {{- if $job.image.imagePullPolicy }} imagePullPolicy: {{ $job.image.imagePullPolicy }} - {{ end }} + {{- end }} {{- with $job.env }} env: {{- range $key, $value := $job.env }} From d3f5bf27b2382a547567a90ea5ff000ab376e86a Mon Sep 17 00:00:00 2001 From: Lucas POUZAC Date: Mon, 13 Oct 2025 16:56:46 +0200 Subject: [PATCH 02/15] feat(cronjob): add tests, and add on job and deployment. --- application/templates/deployment.yaml | 2 +- application/templates/job.yaml | 4 ++-- application/tests/cronjob_test.yaml | 20 ++++++++++++++++++++ application/tests/deployment_test.yaml | 17 +++++++++++++++++ application/tests/job_test.yaml | 21 +++++++++++++++++++++ 5 files changed, 61 insertions(+), 3 deletions(-) diff --git a/application/templates/deployment.yaml b/application/templates/deployment.yaml index d8ef6b04..0b167303 100644 --- a/application/templates/deployment.yaml +++ b/application/templates/deployment.yaml @@ -142,7 +142,7 @@ spec: {{- $image := required "Undefined image for application container" .Values.deployment.image.repository }} {{- with .Values.deployment.image.tag }} {{- $image = print $image ":" . }} {{- end }} {{- with .Values.deployment.image.digest }} {{- $image = print $image "@" . }} {{- end }} - image: {{ $image }} + image: {{ tpl $image $ }} imagePullPolicy: {{ .Values.deployment.image.pullPolicy }} {{- with .Values.deployment.lifecycle }} lifecycle: diff --git a/application/templates/job.yaml b/application/templates/job.yaml index 932f3d83..34a491e1 100644 --- a/application/templates/job.yaml +++ b/application/templates/job.yaml @@ -58,10 +58,10 @@ spec: {{- $image := required (print "Undefined image repo for container '" $name "'") $job.image.repository }} {{- with $job.image.tag }} {{- $image = print $image ":" . }} {{- end }} {{- with $job.image.digest }} {{- $image = print $image "@" . }} {{- end }} - image: {{ $image }} + image: {{ tpl $image $ }} {{- if $job.image.imagePullPolicy }} imagePullPolicy: {{ $job.image.imagePullPolicy }} - {{ end }} + {{- end }} {{- with $job.env }} env: {{- range $key, $value := $job.env }} diff --git a/application/tests/cronjob_test.yaml b/application/tests/cronjob_test.yaml index d2f81d89..7d95bcc4 100644 --- a/application/tests/cronjob_test.yaml +++ b/application/tests/cronjob_test.yaml @@ -223,3 +223,23 @@ tests: content: name: shouldnotmatter image: example-image:example-tag + + - it: uses image templating + set: + custom: + image: + repository: custom-image + tag: custom-tag + digest: sha256:custom-digest + cronJob: + enabled: true + jobs: + example: + image: + repository: "{{ .Values.custom.image.repository }}" + tag: "{{ .Values.custom.image.tag }}" + digest: "{{ .Values.custom.image.digest }}" + asserts: + - equal: + path: spec.jobTemplate.spec.template.spec.containers[0].image + value: custom-image:custom-tag@sha256:custom-digest diff --git a/application/tests/deployment_test.yaml b/application/tests/deployment_test.yaml index dc4b9b0d..46eafbc7 100644 --- a/application/tests/deployment_test.yaml +++ b/application/tests/deployment_test.yaml @@ -162,3 +162,20 @@ tests: - equal: path: spec.template.spec.containers[0].envFrom[0].secretRef.optional value: true + + - it: uses image templating + set: + custom: + image: + repository: custom-image + tag: custom-tag + digest: sha256:custom-digest + deployment: + image: + repository: "{{ .Values.custom.image.repository }}" + tag: "{{ .Values.custom.image.tag }}" + digest: "{{ .Values.custom.image.digest }}" + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: custom-image:custom-tag@sha256:custom-digest diff --git a/application/tests/job_test.yaml b/application/tests/job_test.yaml index 7e67835d..1fac9d6a 100644 --- a/application/tests/job_test.yaml +++ b/application/tests/job_test.yaml @@ -223,3 +223,24 @@ tests: content: name: shouldnotmatter image: example-image:example-tag + + - it: uses image templating + set: + custom: + image: + repository: custom-image + tag: custom-tag + digest: sha256:custom-digest + job: + enabled: true + jobs: + example: + image: + repository: "{{ .Values.custom.image.repository }}" + tag: "{{ .Values.custom.image.tag }}" + digest: "{{ .Values.custom.image.digest }}" + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: custom-image:custom-tag@sha256:custom-digest + From 6fdb73581542ccc78f1d0c2b1c8965f76ea349b8 Mon Sep 17 00:00:00 2001 From: Lucas POUZAC Date: Mon, 13 Oct 2025 17:49:44 +0200 Subject: [PATCH 03/15] feat(cronjob): add tests, and fix empty tag, digest --- application/templates/cronjob.yaml | 12 ++++-- application/templates/deployment.yaml | 12 ++++-- application/templates/job.yaml | 12 ++++-- application/tests/cronjob_test.yaml | 57 ++++++++++++++++++++++++++ application/tests/deployment_test.yaml | 47 +++++++++++++++++++++ application/tests/job_test.yaml | 56 +++++++++++++++++++++++++ 6 files changed, 184 insertions(+), 12 deletions(-) diff --git a/application/templates/cronjob.yaml b/application/templates/cronjob.yaml index 1ad57fd4..a6fc9d59 100644 --- a/application/templates/cronjob.yaml +++ b/application/templates/cronjob.yaml @@ -75,10 +75,14 @@ spec: {{- end }} containers: - name: {{ $name }} - {{- $image := required (print "Undefined image repo for container '" $name "'") $job.image.repository }} - {{- with $job.image.tag }} {{- $image = print $image ":" . }} {{- end }} - {{- with $job.image.digest }} {{- $image = print $image "@" . }} {{- end }} - image: {{ tpl $image $ }} + {{- $image := required (print "Undefined image repo for container '" $name "'") (tpl $job.image.repository $)}} + {{- if and $job.image.tag (tpl $job.image.tag $) }} + {{- $image = print $image ":" (tpl $job.image.tag $) }} + {{- end }} + {{- if and $job.image.digest (tpl $job.image.digest $) }} + {{- $image = print $image "@" (tpl $job.image.digest $) }} + {{- end }} + image: {{ $image }} {{- if $job.image.imagePullPolicy }} imagePullPolicy: {{ $job.image.imagePullPolicy }} {{- end }} diff --git a/application/templates/deployment.yaml b/application/templates/deployment.yaml index 0b167303..61cb5bc8 100644 --- a/application/templates/deployment.yaml +++ b/application/templates/deployment.yaml @@ -139,10 +139,14 @@ spec: name: proxy-tls {{- end }} - name: {{ template "application.name" . }} - {{- $image := required "Undefined image for application container" .Values.deployment.image.repository }} - {{- with .Values.deployment.image.tag }} {{- $image = print $image ":" . }} {{- end }} - {{- with .Values.deployment.image.digest }} {{- $image = print $image "@" . }} {{- end }} - image: {{ tpl $image $ }} + {{- $image := required "Undefined image for application container" (tpl .Values.deployment.image.repository $) }} + {{- if and .Values.deployment.image.tag (tpl .Values.deployment.image.tag $) }} + {{- $image = print $image ":" (tpl .Values.deployment.image.tag $) }} + {{- end }} + {{- if and .Values.deployment.image.digest (tpl .Values.deployment.image.digest $) }} + {{- $image = print $image "@" (tpl .Values.deployment.image.digest $) }} + {{- end }} + image: {{ $image }} imagePullPolicy: {{ .Values.deployment.image.pullPolicy }} {{- with .Values.deployment.lifecycle }} lifecycle: diff --git a/application/templates/job.yaml b/application/templates/job.yaml index 34a491e1..464e202f 100644 --- a/application/templates/job.yaml +++ b/application/templates/job.yaml @@ -55,10 +55,14 @@ spec: {{- end }} containers: - name: {{ $name }} - {{- $image := required (print "Undefined image repo for container '" $name "'") $job.image.repository }} - {{- with $job.image.tag }} {{- $image = print $image ":" . }} {{- end }} - {{- with $job.image.digest }} {{- $image = print $image "@" . }} {{- end }} - image: {{ tpl $image $ }} + {{- $image := required (print "Undefined image repo for container '" $name "'") (tpl $job.image.repository $)}} + {{- if and $job.image.tag (tpl $job.image.tag $) }} + {{- $image = print $image ":" (tpl $job.image.tag $) }} + {{- end }} + {{- if and $job.image.digest (tpl $job.image.digest $) }} + {{- $image = print $image "@" (tpl $job.image.digest $) }} + {{- end }} + image: {{ $image }} {{- if $job.image.imagePullPolicy }} imagePullPolicy: {{ $job.image.imagePullPolicy }} {{- end }} diff --git a/application/tests/cronjob_test.yaml b/application/tests/cronjob_test.yaml index 7d95bcc4..3581e21b 100644 --- a/application/tests/cronjob_test.yaml +++ b/application/tests/cronjob_test.yaml @@ -243,3 +243,60 @@ tests: - equal: path: spec.jobTemplate.spec.template.spec.containers[0].image value: custom-image:custom-tag@sha256:custom-digest + + - it: uses image templating (without tag) + set: + custom: + image: + repository: custom-image + digest: sha256:custom-digest + cronJob: + enabled: true + jobs: + example: + image: + repository: "{{ .Values.custom.image.repository }}" + tag: "{{ .Values.custom.image.tag }}" + digest: "{{ .Values.custom.image.digest }}" + asserts: + - equal: + path: spec.jobTemplate.spec.template.spec.containers[0].image + value: custom-image@sha256:custom-digest + + - it: uses image templating (without digest) + set: + custom: + image: + repository: custom-image + tag: custom-tag + cronJob: + enabled: true + jobs: + example: + image: + repository: "{{ .Values.custom.image.repository }}" + tag: "{{ .Values.custom.image.tag }}" + digest: "{{ .Values.custom.image.digest }}" + asserts: + - equal: + path: spec.jobTemplate.spec.template.spec.containers[0].image + value: custom-image:custom-tag + + - it: uses image templating (without tag and digest) + set: + custom: + image: + repository: custom-image + cronJob: + enabled: true + jobs: + example: + image: + repository: "{{ .Values.custom.image.repository }}" + tag: "{{ .Values.custom.image.tag }}" + digest: "{{ .Values.custom.image.digest }}" + asserts: + - equal: + path: spec.jobTemplate.spec.template.spec.containers[0].image + value: custom-image + diff --git a/application/tests/deployment_test.yaml b/application/tests/deployment_test.yaml index 46eafbc7..416d4d4e 100644 --- a/application/tests/deployment_test.yaml +++ b/application/tests/deployment_test.yaml @@ -179,3 +179,50 @@ tests: - equal: path: spec.template.spec.containers[0].image value: custom-image:custom-tag@sha256:custom-digest + + - it: uses image templating (without tag) + set: + custom: + image: + repository: custom-image + digest: sha256:custom-digest + deployment: + image: + repository: "{{ .Values.custom.image.repository }}" + tag: "{{ .Values.custom.image.tag }}" + digest: "{{ .Values.custom.image.digest }}" + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: custom-image@sha256:custom-digest + + - it: uses image templating (without digest) + set: + custom: + image: + repository: custom-image + tag: custom-tag + deployment: + image: + repository: "{{ .Values.custom.image.repository }}" + tag: "{{ .Values.custom.image.tag }}" + digest: "{{ .Values.custom.image.digest }}" + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: custom-image:custom-tag + + - it: uses image templating (without tag and digest) + set: + custom: + image: + repository: custom-image + deployment: + image: + repository: "{{ .Values.custom.image.repository }}" + tag: "{{ .Values.custom.image.tag }}" + digest: "{{ .Values.custom.image.digest }}" + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: custom-image diff --git a/application/tests/job_test.yaml b/application/tests/job_test.yaml index 1fac9d6a..7b166dcd 100644 --- a/application/tests/job_test.yaml +++ b/application/tests/job_test.yaml @@ -244,3 +244,59 @@ tests: path: spec.template.spec.containers[0].image value: custom-image:custom-tag@sha256:custom-digest + - it: uses image templating (without tag) + set: + custom: + image: + repository: custom-image + digest: sha256:custom-digest + job: + enabled: true + jobs: + example: + image: + repository: "{{ .Values.custom.image.repository }}" + tag: "{{ .Values.custom.image.tag }}" + digest: "{{ .Values.custom.image.digest }}" + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: custom-image@sha256:custom-digest + + - it: uses image templating (without digest) + set: + custom: + image: + repository: custom-image + tag: custom-tag + job: + enabled: true + jobs: + example: + image: + repository: "{{ .Values.custom.image.repository }}" + tag: "{{ .Values.custom.image.tag }}" + digest: "{{ .Values.custom.image.digest }}" + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: custom-image:custom-tag + + - it: uses image templating (without tag and digest) + set: + custom: + image: + repository: custom-image + job: + enabled: true + jobs: + example: + image: + repository: "{{ .Values.custom.image.repository }}" + tag: "{{ .Values.custom.image.tag }}" + digest: "{{ .Values.custom.image.digest }}" + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: custom-image + From 8ffd45890aac51e3cea4f70f4aca5ef0c69718d7 Mon Sep 17 00:00:00 2001 From: Lucas POUZAC Date: Mon, 13 Oct 2025 17:50:34 +0200 Subject: [PATCH 04/15] feat(cronjob): cleanup --- application/tests/cronjob_test.yaml | 3 +-- application/tests/deployment_test.yaml | 2 +- application/tests/job_test.yaml | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/application/tests/cronjob_test.yaml b/application/tests/cronjob_test.yaml index 3581e21b..5685d6b5 100644 --- a/application/tests/cronjob_test.yaml +++ b/application/tests/cronjob_test.yaml @@ -298,5 +298,4 @@ tests: asserts: - equal: path: spec.jobTemplate.spec.template.spec.containers[0].image - value: custom-image - + value: custom-image \ No newline at end of file diff --git a/application/tests/deployment_test.yaml b/application/tests/deployment_test.yaml index 416d4d4e..deba4686 100644 --- a/application/tests/deployment_test.yaml +++ b/application/tests/deployment_test.yaml @@ -225,4 +225,4 @@ tests: asserts: - equal: path: spec.template.spec.containers[0].image - value: custom-image + value: custom-image \ No newline at end of file diff --git a/application/tests/job_test.yaml b/application/tests/job_test.yaml index 7b166dcd..4b63d1a0 100644 --- a/application/tests/job_test.yaml +++ b/application/tests/job_test.yaml @@ -298,5 +298,4 @@ tests: asserts: - equal: path: spec.template.spec.containers[0].image - value: custom-image - + value: custom-image \ No newline at end of file From e6d270e1d06b74468450967e3a9d915d98493030 Mon Sep 17 00:00:00 2001 From: Lucas POUZAC Date: Mon, 13 Oct 2025 17:56:57 +0200 Subject: [PATCH 05/15] feat(cronjob): Use application.tplvalues.render --- application/templates/cronjob.yaml | 10 +++++----- application/templates/deployment.yaml | 10 +++++----- application/templates/job.yaml | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/application/templates/cronjob.yaml b/application/templates/cronjob.yaml index a6fc9d59..a4ab103c 100644 --- a/application/templates/cronjob.yaml +++ b/application/templates/cronjob.yaml @@ -75,12 +75,12 @@ spec: {{- end }} containers: - name: {{ $name }} - {{- $image := required (print "Undefined image repo for container '" $name "'") (tpl $job.image.repository $)}} - {{- if and $job.image.tag (tpl $job.image.tag $) }} - {{- $image = print $image ":" (tpl $job.image.tag $) }} + {{- $image := required (print "Undefined image repo for container '" $name "'") (include "application.tplvalues.render" ( dict "value" $job.image.repository "context" $ ))}} + {{- if and $job.image.tag (include "application.tplvalues.render" ( dict "value" $job.image.tag "context" $ )) }} + {{- $image = print $image ":" (include "application.tplvalues.render" ( dict "value" $job.image.tag "context" $ )) }} {{- end }} - {{- if and $job.image.digest (tpl $job.image.digest $) }} - {{- $image = print $image "@" (tpl $job.image.digest $) }} + {{- if and $job.image.digest (include "application.tplvalues.render" ( dict "value" $job.image.digest "context" $ )) }} + {{- $image = print $image "@" (include "application.tplvalues.render" ( dict "value" $job.image.digest "context" $ )) }} {{- end }} image: {{ $image }} {{- if $job.image.imagePullPolicy }} diff --git a/application/templates/deployment.yaml b/application/templates/deployment.yaml index 61cb5bc8..1c55a1f6 100644 --- a/application/templates/deployment.yaml +++ b/application/templates/deployment.yaml @@ -139,12 +139,12 @@ spec: name: proxy-tls {{- end }} - name: {{ template "application.name" . }} - {{- $image := required "Undefined image for application container" (tpl .Values.deployment.image.repository $) }} - {{- if and .Values.deployment.image.tag (tpl .Values.deployment.image.tag $) }} - {{- $image = print $image ":" (tpl .Values.deployment.image.tag $) }} + {{- $image := required "Undefined image for application container" (include "application.tplvalues.render" ( dict "value" .Values.deployment.image.repository "context" $ )) }} + {{- if and .Values.deployment.image.tag (include "application.tplvalues.render" ( dict "value" .Values.deployment.image.tag "context" $ )) }} + {{- $image = print $image ":" (include "application.tplvalues.render" ( dict "value" .Values.deployment.image.tag "context" $ )) }} {{- end }} - {{- if and .Values.deployment.image.digest (tpl .Values.deployment.image.digest $) }} - {{- $image = print $image "@" (tpl .Values.deployment.image.digest $) }} + {{- if and .Values.deployment.image.digest (include "application.tplvalues.render" ( dict "value" .Values.deployment.image.digest "context" $ )) }} + {{- $image = print $image "@" (include "application.tplvalues.render" ( dict "value" .Values.deployment.image.digest "context" $ )) }} {{- end }} image: {{ $image }} imagePullPolicy: {{ .Values.deployment.image.pullPolicy }} diff --git a/application/templates/job.yaml b/application/templates/job.yaml index 464e202f..b9c0e540 100644 --- a/application/templates/job.yaml +++ b/application/templates/job.yaml @@ -55,12 +55,12 @@ spec: {{- end }} containers: - name: {{ $name }} - {{- $image := required (print "Undefined image repo for container '" $name "'") (tpl $job.image.repository $)}} - {{- if and $job.image.tag (tpl $job.image.tag $) }} - {{- $image = print $image ":" (tpl $job.image.tag $) }} + {{- $image := required (print "Undefined image repo for container '" $name "'") (include "application.tplvalues.render" ( dict "value" $job.image.repository "context" $ ))}} + {{- if and $job.image.tag (include "application.tplvalues.render" ( dict "value" $job.image.tag "context" $ )) }} + {{- $image = print $image ":" (include "application.tplvalues.render" ( dict "value" $job.image.tag "context" $ )) }} {{- end }} - {{- if and $job.image.digest (tpl $job.image.digest $) }} - {{- $image = print $image "@" (tpl $job.image.digest $) }} + {{- if and $job.image.digest (include "application.tplvalues.render" ( dict "value" $job.image.digest "context" $ )) }} + {{- $image = print $image "@" (include "application.tplvalues.render" ( dict "value" $job.image.digest "context" $ )) }} {{- end }} image: {{ $image }} {{- if $job.image.imagePullPolicy }} From 671f11f764572f904495184624ba8bf05e52a7c8 Mon Sep 17 00:00:00 2001 From: Lucas Pouzac Date: Mon, 13 Oct 2025 18:12:08 +0200 Subject: [PATCH 06/15] Update application/tests/job_test.yaml Co-authored-by: Zadkiel AHARONIAN --- application/tests/job_test.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/application/tests/job_test.yaml b/application/tests/job_test.yaml index 4b63d1a0..bd80928a 100644 --- a/application/tests/job_test.yaml +++ b/application/tests/job_test.yaml @@ -243,7 +243,6 @@ tests: - equal: path: spec.template.spec.containers[0].image value: custom-image:custom-tag@sha256:custom-digest - - it: uses image templating (without tag) set: custom: From ebf418c143acb3f6c5b1aeec7d5b81baa398bf64 Mon Sep 17 00:00:00 2001 From: Lucas POUZAC Date: Wed, 15 Oct 2025 08:20:35 +0200 Subject: [PATCH 07/15] Rewrite most readeable --- application/templates/cronjob.yaml | 16 +++++++++------- application/templates/deployment.yaml | 16 +++++++++------- application/templates/job.yaml | 16 +++++++++------- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/application/templates/cronjob.yaml b/application/templates/cronjob.yaml index a4ab103c..8b5b8afd 100644 --- a/application/templates/cronjob.yaml +++ b/application/templates/cronjob.yaml @@ -75,13 +75,15 @@ spec: {{- end }} containers: - name: {{ $name }} - {{- $image := required (print "Undefined image repo for container '" $name "'") (include "application.tplvalues.render" ( dict "value" $job.image.repository "context" $ ))}} - {{- if and $job.image.tag (include "application.tplvalues.render" ( dict "value" $job.image.tag "context" $ )) }} - {{- $image = print $image ":" (include "application.tplvalues.render" ( dict "value" $job.image.tag "context" $ )) }} - {{- end }} - {{- if and $job.image.digest (include "application.tplvalues.render" ( dict "value" $job.image.digest "context" $ )) }} - {{- $image = print $image "@" (include "application.tplvalues.render" ( dict "value" $job.image.digest "context" $ )) }} - {{- end }} + {{- $repo := include "application.tplvalues.render" (dict "value" $job.image.repository "context" $) -}} + {{- $repo = required (printf "Undefined image repo for container '%s'" $name) $repo -}} + + {{- $tag := include "application.tplvalues.render" (dict "value" $job.image.tag "context" $) -}} + {{- $digest := include "application.tplvalues.render" (dict "value" $job.image.digest "context" $) -}} + + {{- $image := $repo -}} + {{- with $tag }} {{- $image = print $image ":" . }} {{- end }} + {{- with $digest }} {{- $image = print $image "@" . }} {{- end }} image: {{ $image }} {{- if $job.image.imagePullPolicy }} imagePullPolicy: {{ $job.image.imagePullPolicy }} diff --git a/application/templates/deployment.yaml b/application/templates/deployment.yaml index 1c55a1f6..544cc8c1 100644 --- a/application/templates/deployment.yaml +++ b/application/templates/deployment.yaml @@ -139,13 +139,15 @@ spec: name: proxy-tls {{- end }} - name: {{ template "application.name" . }} - {{- $image := required "Undefined image for application container" (include "application.tplvalues.render" ( dict "value" .Values.deployment.image.repository "context" $ )) }} - {{- if and .Values.deployment.image.tag (include "application.tplvalues.render" ( dict "value" .Values.deployment.image.tag "context" $ )) }} - {{- $image = print $image ":" (include "application.tplvalues.render" ( dict "value" .Values.deployment.image.tag "context" $ )) }} - {{- end }} - {{- if and .Values.deployment.image.digest (include "application.tplvalues.render" ( dict "value" .Values.deployment.image.digest "context" $ )) }} - {{- $image = print $image "@" (include "application.tplvalues.render" ( dict "value" .Values.deployment.image.digest "context" $ )) }} - {{- end }} + {{- $repo := include "application.tplvalues.render" (dict "value" .Values.deployment.image.repository "context" $) -}} + {{- $repo = required "Undefined image for application container" $repo -}} + + {{- $tag := include "application.tplvalues.render" (dict "value" .Values.deployment.image.tag "context" $) -}} + {{- $digest := include "application.tplvalues.render" (dict "value" .Values.deployment.image.digest "context" $) -}} + + {{- $image := $repo -}} + {{- with $tag }} {{- $image = print $image ":" . }} {{- end }} + {{- with $digest }} {{- $image = print $image "@" . }} {{- end }} image: {{ $image }} imagePullPolicy: {{ .Values.deployment.image.pullPolicy }} {{- with .Values.deployment.lifecycle }} diff --git a/application/templates/job.yaml b/application/templates/job.yaml index b9c0e540..7ea75c1c 100644 --- a/application/templates/job.yaml +++ b/application/templates/job.yaml @@ -55,13 +55,15 @@ spec: {{- end }} containers: - name: {{ $name }} - {{- $image := required (print "Undefined image repo for container '" $name "'") (include "application.tplvalues.render" ( dict "value" $job.image.repository "context" $ ))}} - {{- if and $job.image.tag (include "application.tplvalues.render" ( dict "value" $job.image.tag "context" $ )) }} - {{- $image = print $image ":" (include "application.tplvalues.render" ( dict "value" $job.image.tag "context" $ )) }} - {{- end }} - {{- if and $job.image.digest (include "application.tplvalues.render" ( dict "value" $job.image.digest "context" $ )) }} - {{- $image = print $image "@" (include "application.tplvalues.render" ( dict "value" $job.image.digest "context" $ )) }} - {{- end }} + {{- $repo := include "application.tplvalues.render" (dict "value" $job.image.repository "context" $) -}} + {{- $repo = required (printf "Undefined image repo for container '%s'" $name) $repo -}} + + {{- $tag := include "application.tplvalues.render" (dict "value" $job.image.tag "context" $) -}} + {{- $digest := include "application.tplvalues.render" (dict "value" $job.image.digest "context" $) -}} + + {{- $image := $repo -}} + {{- with $tag }} {{- $image = print $image ":" . }} {{- end }} + {{- with $digest }} {{- $image = print $image "@" . }} {{- end }} image: {{ $image }} {{- if $job.image.imagePullPolicy }} imagePullPolicy: {{ $job.image.imagePullPolicy }} From 5c0dbad8aaf4fcaeffb63bf80e439dddf135a818 Mon Sep 17 00:00:00 2001 From: Lucas Pouzac Date: Wed, 15 Oct 2025 10:01:47 +0200 Subject: [PATCH 08/15] Update application/tests/cronjob_test.yaml Co-authored-by: Zadkiel AHARONIAN --- application/tests/cronjob_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/tests/cronjob_test.yaml b/application/tests/cronjob_test.yaml index 5685d6b5..5fde5ba6 100644 --- a/application/tests/cronjob_test.yaml +++ b/application/tests/cronjob_test.yaml @@ -298,4 +298,4 @@ tests: asserts: - equal: path: spec.jobTemplate.spec.template.spec.containers[0].image - value: custom-image \ No newline at end of file + value: custom-image From 2099a4cd26a2d15e1b88c62e2c759f979bf3774f Mon Sep 17 00:00:00 2001 From: Lucas Pouzac Date: Wed, 15 Oct 2025 10:01:52 +0200 Subject: [PATCH 09/15] Update application/tests/job_test.yaml Co-authored-by: Zadkiel AHARONIAN --- application/tests/job_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/tests/job_test.yaml b/application/tests/job_test.yaml index bd80928a..68cc4e0b 100644 --- a/application/tests/job_test.yaml +++ b/application/tests/job_test.yaml @@ -297,4 +297,4 @@ tests: asserts: - equal: path: spec.template.spec.containers[0].image - value: custom-image \ No newline at end of file + value: custom-image From 2ac9b3b3106a0c5e09a22f1fd09d2c8cb52f2146 Mon Sep 17 00:00:00 2001 From: Lucas Pouzac Date: Wed, 15 Oct 2025 10:01:59 +0200 Subject: [PATCH 10/15] Update application/tests/deployment_test.yaml Co-authored-by: Zadkiel AHARONIAN --- application/tests/deployment_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/tests/deployment_test.yaml b/application/tests/deployment_test.yaml index deba4686..416d4d4e 100644 --- a/application/tests/deployment_test.yaml +++ b/application/tests/deployment_test.yaml @@ -225,4 +225,4 @@ tests: asserts: - equal: path: spec.template.spec.containers[0].image - value: custom-image \ No newline at end of file + value: custom-image From 85d49238c9c23c36f42e5fd67c3a8b7ba66d7bf7 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Wed, 15 Oct 2025 10:35:39 +0200 Subject: [PATCH 11/15] Change comments to indicate tpl/string type for image fields --- application/values.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/values.yaml b/application/values.yaml index fe202053..17ddc70b 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -283,16 +283,16 @@ deployment: # @section -- Deployment Parameters revisionHistoryLimit: 2 image: - # -- (string) Repository. + # -- (tpl/string) Repository. # @section -- Deployment Parameters repository: "" - # -- (string) Tag. + # -- (tpl/string) Tag. # @section -- Deployment Parameters tag: "" - # -- (string) Image digest. If set to a non-empty value, digest takes precedence on the tag. + # -- (tpl/string) Image digest. If set to a non-empty value, digest takes precedence on the tag. # @section -- Deployment Parameters digest: "" - # -- (string) Image pull policy. + # -- (tpl/string) Image pull policy. # @section -- Deployment Parameters pullPolicy: IfNotPresent # -- (object) DNS config for the pods. From fa1f60b5269bc8cdb9d53ddb47dc36be09289e67 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Wed, 15 Oct 2025 10:36:20 +0200 Subject: [PATCH 12/15] Change image fields to use tpl/string type --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2ef62edd..704764e5 100644 --- a/README.md +++ b/README.md @@ -82,9 +82,9 @@ helm delete --namespace test my-application | deployment.affinity | object | `nil` | Affinity for the pods. | | deployment.topologySpreadConstraints | list | `nil` | Topology spread constraints for the pods. | | deployment.revisionHistoryLimit | int | `2` | Number of ReplicaSet revisions to retain. | -| deployment.image.repository | string | `""` | Repository. | -| deployment.image.tag | string | `""` | Tag. | -| deployment.image.digest | string | `""` | Image digest. If set to a non-empty value, digest takes precedence on the tag. | +| deployment.image.repository | tpl/string | `""` | Repository. | +| deployment.image.tag | tpl/string | `""` | Tag. | +| deployment.image.digest | tpl/string | `""` | Image digest. If set to a non-empty value, digest takes precedence on the tag. | | deployment.image.pullPolicy | string | `"IfNotPresent"` | Image pull policy. | | deployment.dnsConfig | object | `nil` | DNS config for the pods. | | deployment.dnsPolicy | string | `""` | DNS Policy. | From 42b9c426db2480286764fb83a5585728db6c036b Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Wed, 15 Oct 2025 10:36:59 +0200 Subject: [PATCH 13/15] Update values.yaml --- application/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/values.yaml b/application/values.yaml index 17ddc70b..d3f99710 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -292,7 +292,7 @@ deployment: # -- (tpl/string) Image digest. If set to a non-empty value, digest takes precedence on the tag. # @section -- Deployment Parameters digest: "" - # -- (tpl/string) Image pull policy. + # -- (string) Image pull policy. # @section -- Deployment Parameters pullPolicy: IfNotPresent # -- (object) DNS config for the pods. From 9914175dc7bc2c51785a653fad8158bc088cec4a Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Wed, 15 Oct 2025 10:37:49 +0200 Subject: [PATCH 14/15] Apply suggestion from @aslafy-z --- application/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/values.yaml b/application/values.yaml index d3f99710..c71baccd 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -289,7 +289,7 @@ deployment: # -- (tpl/string) Tag. # @section -- Deployment Parameters tag: "" - # -- (tpl/string) Image digest. If set to a non-empty value, digest takes precedence on the tag. + # -- (tpl/string) Image digest. If resolved to a non-empty value, digest takes precedence on the tag. # @section -- Deployment Parameters digest: "" # -- (string) Image pull policy. From fe60b01c76489d10597d81e877577bec4e4f6a6d Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Wed, 15 Oct 2025 10:38:05 +0200 Subject: [PATCH 15/15] Apply suggestion from @aslafy-z --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 704764e5..b0f528f1 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ helm delete --namespace test my-application | deployment.revisionHistoryLimit | int | `2` | Number of ReplicaSet revisions to retain. | | deployment.image.repository | tpl/string | `""` | Repository. | | deployment.image.tag | tpl/string | `""` | Tag. | -| deployment.image.digest | tpl/string | `""` | Image digest. If set to a non-empty value, digest takes precedence on the tag. | +| deployment.image.digest | tpl/string | `""` | Image digest. If resolved to a non-empty value, digest takes precedence on the tag. | | deployment.image.pullPolicy | string | `"IfNotPresent"` | Image pull policy. | | deployment.dnsConfig | object | `nil` | DNS config for the pods. | | deployment.dnsPolicy | string | `""` | DNS Policy. |