diff --git a/charts/logprep/templates/deployment.yaml b/charts/logprep/templates/deployment.yaml index f5be0bf5d..18167c658 100644 --- a/charts/logprep/templates/deployment.yaml +++ b/charts/logprep/templates/deployment.yaml @@ -27,6 +27,10 @@ spec: {{- if .Values.secrets.imagePullSecret }} - name: {{ .Values.secrets.imagePullSecret.name }} {{- end }} + {{- if .Values.initContainers }} + initContainers: + {{- toYaml .Values.initContainers | nindent 8 }} + {{- end }} containers: - name: logprep {{- if .Values.containerSecurityContext.enabled }} diff --git a/tests/unit/charts/test_deployment.py b/tests/unit/charts/test_deployment.py index f9a4a9810..2873dad36 100644 --- a/tests/unit/charts/test_deployment.py +++ b/tests/unit/charts/test_deployment.py @@ -98,6 +98,18 @@ def test_add_security_context(self): security_context = self.deployment["spec.template.spec.containers.0.securityContext"] assert security_context["allowPriviledgeEscalation"] == "false" + def test_init_containers(self): + self.manifests = self.render_chart( + "logprep", + { + "initContainers": {"name": "test-init"}, + }, + ) + + assert self.deployment["spec.template.spec.initContainers"] + init_container = self.deployment["spec.template.spec.initContainers"] + assert init_container["name"] == "test-init" + def test_resources(self): assert self.deployment["spec.template.spec.containers.0.resources"] resources = self.deployment["spec.template.spec.containers.0.resources"]