{{- 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 }}