问题描述
我无法找到一种获取文件内容并对该内容运行tpl
的方法
Yaml输入输入文件:
spec:
{{- (tpl ($.Files.Glob config.yaml).AsConfig $) | nindent 2 }}
config.yaml的内容
key1: {{ .Values.value1 }}
key2: {{ .Values.value2 }}
values.yaml文件的内容
value1: value1
value2: value2
头盔模板输出:
spec:
config.yaml: |-
key1: value2
key2: value2
我想要的
spec:
# config.yaml: |- should be removed
key1: value2
key2: value2
解决方法
使用.Files.Get
代替Glob
方法。
spec:
{{ tpl ( .Files.Get "config.yaml" ) . | indent 2 }}
有关更多详细信息,请访问-Accessing Files Inside Templates