What is the usage of include in helm

1/3/2020

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 }}
-- Jithin Kumar S
kubectl
kubernetes
kubernetes-helm

1 Answer

1/3/2020

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.

-- LazerBass
Source: StackOverflow