英文:
What is the usage of include in helm
问题
在Helm中,include和{{}}之间的区别是什么?
例如:
metadata:
name: {{ include "cluster-dev.fullname" . }}
这里不能这样吗?
metadata:
name: {{ Values.nameOverride }}
英文:
I searched a lot but didnt get a right answer, what is the difference between include and {{}} in helm.
ex :
metadata:
name: {{ include "cluster-dev.fullname" . }}
here can't it be like this
metadata:
name: {{ Values.nameOverride }}
答案1
得分: 6
include
用于与模板一起使用,而不仅仅是输出值。
根据文档
>为了使包含模板并对该模板的输出执行操作成为可能,Helm有一个特殊的include函数:
>
>{{ include "toYaml" $value | indent 2 }}
>
>上述代码包含名为toYaml
的模板,传递给它$value
,然后将该模板的输出传递给indent
函数。
英文:
include
is meant to be used with templates and not to simply output values.
According to the documentation
>To make it possible to include a template, and then perform an operation on that template’s output, Helm has a special include function:
>
>{{ include "toYaml" $value | indent 2 }}
>
>The above includes a template called toYaml,
passes it $value
, and then passes the output of that template to the indent
function.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论