3 SPDX-License-Identifier: APACHE-2.0
6 {{/* vim: set filetype=mustache: */}}
8 Renders a value that contains template perhaps with scope if the scope is present.
10 {{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ ) }}
11 {{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }}
13 {{- define "common.tplvalues.render" -}}
14 {{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }}
15 {{- if contains "{{" (toJson .value) }}
17 {{- tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }}
19 {{- tpl $value .context }}
27 Merge a list of values that contains template after rendering them.
28 Merge precedence is consistent with http://masterminds.github.io/sprig/dicts.html#merge-mustmerge
30 {{ include "common.tplvalues.merge" ( dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $ ) }}
32 {{- define "common.tplvalues.merge" -}}
35 {{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst -}}