include在Helm中的用法是什么?

huangapple go评论78阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年1月3日 16:47:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/59575498.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定