Skip to content

Commit

Permalink
add ability to configure init containers in helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
djkhl committed Nov 26, 2024
1 parent 4d80664 commit abe6c1f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions charts/logprep/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/charts/test_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit abe6c1f

Please sign in to comment.