Skip to content

Commit ad68b47

Browse files
committed
refactor: Simplify image helper templates using coalesce
Replace nested if statements with coalesce function as suggested by @wrenix in PR review. This makes the code cleaner and more idiomatic while maintaining the same functionality.
1 parent 2647eea commit ad68b47

File tree

1 file changed

+2
-18
lines changed
  • charts/opencloud/templates/_helpers

1 file changed

+2
-18
lines changed

charts/opencloud/templates/_helpers/tpl.yaml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -152,30 +152,14 @@ Create a fully qualified Tika name.
152152
Return the image registry, using global override if set
153153
*/}}
154154
{{- define "opencloud.image.registry" -}}
155-
{{- $registry := .registry -}}
156-
{{- if .global -}}
157-
{{- if .global.image -}}
158-
{{- if .global.image.registry -}}
159-
{{- $registry = .global.image.registry -}}
160-
{{- end -}}
161-
{{- end -}}
162-
{{- end -}}
163-
{{- $registry -}}
155+
{{- coalesce .global.image.registry .registry -}}
164156
{{- end -}}
165157

166158
{{/*
167159
Return the image pull policy, using global override if set
168160
*/}}
169161
{{- define "opencloud.image.pullPolicy" -}}
170-
{{- $pullPolicy := .pullPolicy -}}
171-
{{- if .global -}}
172-
{{- if .global.image -}}
173-
{{- if .global.image.pullPolicy -}}
174-
{{- $pullPolicy = .global.image.pullPolicy -}}
175-
{{- end -}}
176-
{{- end -}}
177-
{{- end -}}
178-
{{- $pullPolicy -}}
162+
{{- coalesce .global.image.pullPolicy .pullPolicy -}}
179163
{{- end -}}
180164

181165
{{/*

0 commit comments

Comments
 (0)