【发布时间】:2021-06-03 04:09:05
【问题描述】:
我正在尝试使用 tpl 函数呈现文件。我正在使用 Files.Get 检索文件的内容,在我对其使用 tpl 函数之前它工作正常。
我的输入文件是:
apiVersion: autoscaling/v2beta2
我的 helm 模板是:
{{- $files := .Files }}
{{- tpl ($files.Get "files/autoscaling.yaml" ) . -}}
我不得不使用 $files 因为它会抛出错误:
在 <.files.get>:无法评估类型接口 {}
中的字段文件
我在运行 helm 模板时看到的输出是
Error: template: subchart-demoapp/templates/sub-deployments.yaml:5:47: executing "subchart-demoapp/templates/sub-deployments.yaml" at <.>: wrong type for value; expected chartutil.Values; got string
helm.go:84: [debug] template: subchart-demoapp/templates/sub-deployments.yaml:5:47: executing "subchart-demoapp/templates/sub-deployments.yaml" at <.>: wrong type for value; expected chartutil.Values; got string
我的掌舵版本是:
version.BuildInfo{Version:"v3.2.1", GitCommit:"fe51cd1e31e6a202cba7dead9552a6d418ded79a", GitTreeState:"clean", GoVersion:"go1.13.10"}
感谢您的帮助。
【问题讨论】: