Files
common/helm/templates/_tplvalues.tpl
2025-10-20 14:18:25 +02:00

29 lines
898 B
Smarty

{{- define "common.tplvalues.render" -}}
{{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }}
{{- if contains "{{" (toJson .value) }}
{{- if .scope }}
{{ tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }}
{{- else }}
{{ tpl $value .context }}
{{- end }}
{{- else }}
{{ $value }}
{{- end }}
{{- end }}
{{- define "common.tplvalues.merge" }}
{{- $dst := dict }}
{{- range .values }}
{{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst }}
{{- end }}
{{ $dst | toYaml }}
{{- end }}
{{- define "common.tplvalues.merge-overwrite" }}
{{- $dst := dict }}
{{- range .values }}
{{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | mergeOverwrite $dst }}
{{- end }}
{{ $dst | toYaml }}
{{- end }}