2 # Copyright © Original (https://github.com/bitnami/charts) VMware, Inc.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 {{/* vim: set filetype=mustache: */}}
19 Renders a value that contains template perhaps with scope if the scope is present.
21 {{ include "common.tplvalues._render" ( dict "value" .Values.path.to.the.Value "context" $ ) }}
22 {{ include "common.tplvalues._render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }}
24 {{- define "common.tplvalues._render" -}}
25 {{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }}
26 {{- if contains "{{" (toJson .value) }}
28 {{- tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }}
30 {{- tpl $value .context }}
38 Merge a list of values that contains template after rendering them.
39 Merge precedence is consistent with http://masterminds.github.io/sprig/dicts.html#merge-mustmerge
41 {{ include "common.tplvalues._merge" ( dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $ ) }}
43 {{- define "common.tplvalues._merge" -}}
46 {{- $dst = include "common.tplvalues._render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst -}}