38 lines
1.4 KiB
Smarty
38 lines
1.4 KiB
Smarty
{{/*
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
or more contributor license agreements. See the NOTICE file
|
|
distributed with this work for additional information
|
|
regarding copyright ownership. The ASF licenses this file
|
|
to you under the Apache License, Version 2.0 (the
|
|
"License"); you may not use this file except in compliance
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
software distributed under the License is distributed on an
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations
|
|
under the License.
|
|
*/}}
|
|
|
|
{{/*
|
|
Renders a value that contains template perhaps with scope if the scope is present.
|
|
Usage:
|
|
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ ) }}
|
|
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }}
|
|
*/}}
|
|
{{- 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 -}}
|