From 941c715ef20f4534d7e2e981447fe5dbdd85e7b7 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Sun, 18 Oct 2026 17:10:29 +0200 Subject: [PATCH] fix(deployment): template initContainers --- templates/deployment.yaml | 4 ++++ unittests/deployments/deployment.yaml | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/templates/deployment.yaml b/templates/deployment.yaml index b4579a1..36a4d9d 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -105,6 +105,10 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.deployment.initContainers }} + initContainers: + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.deployment.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/unittests/deployments/deployment.yaml b/unittests/deployments/deployment.yaml index db7d325..68e676e 100644 --- a/unittests/deployments/deployment.yaml +++ b/unittests/deployments/deployment.yaml @@ -129,6 +129,9 @@ tests: - notExists: path: spec.template.spec.imagePullSecrets template: templates/deployment.yaml + - notExists: + path: spec.template.spec.initContainers + template: templates/deployment.yaml - notExists: path: spec.template.spec.nodeSelector template: templates/deployment.yaml @@ -463,6 +466,22 @@ tests: - name: my-special-secret template: templates/deployment.yaml +- it: Test initContainers + set: + # Ensure that the secrets and config maps are well configured. + + # Normal test values + deployment.initContainers: + - name: busybox + image: docker.io/library/busybox:latest + asserts: + - contains: + path: spec.template.spec.initContainers + content: + name: busybox + image: docker.io/library/busybox:latest + template: templates/deployment.yaml + - it: Test nodeSelector set: # Ensure that the secrets and config maps are well configured.