Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions application/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ Usage:
{{ include "application.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "application.tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- $value := .value -}}
{{- if or (not $value) (kindIs "invalid" $value) -}}
{{- "" -}}
{{- else if typeIs "string" $value -}}
{{- tpl $value .context -}}
{{- else -}}
{{- tpl ($value | toYaml) .context -}}
{{- end -}}
{{- end -}}

{{/*
Expand Down
17 changes: 17 additions & 0 deletions application/tests/cronjob_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,23 @@ tests:
path: spec.jobTemplate.spec.template.spec.containers[0].image
value: custom-image

- it: does not render @null when digest field is omitted
set:
cronJob:
enabled: true
jobs:
example:
image:
repository: example-image
tag: example-tag
asserts:
- equal:
path: spec.jobTemplate.spec.template.spec.containers[0].image
value: example-image:example-tag
- notMatchRegex:
path: spec.jobTemplate.spec.template.spec.containers[0].image
pattern: "@null"

- it: configures automount service account token by default
set:
cronJob:
Expand Down
12 changes: 12 additions & 0 deletions application/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ tests:
path: spec.template.spec.containers[0].image
value: example-image:example-tag@sha256:example-digest

- it: does not render @null when digest field is omitted
set:
deployment.image.repository: example-image
deployment.image.tag: example-tag
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: example-image:example-tag
- notMatchRegex:
path: spec.template.spec.containers[0].image
pattern: "@null"

- it: yields empty service account name when disabled
set:
rbac.serviceAccount.enabled: false
Expand Down
17 changes: 17 additions & 0 deletions application/tests/job_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,23 @@ tests:
path: spec.template.spec.containers[0].image
value: custom-image

- it: does not render @null when digest field is omitted
set:
job:
enabled: true
jobs:
example:
image:
repository: example-image
tag: example-tag
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: example-image:example-tag
- notMatchRegex:
path: spec.template.spec.containers[0].image
pattern: "@null"

- it: configures automount service account token by default
set:
job:
Expand Down
Loading