What does `toYaml` do and when do you use it?
BeginnerConceptTemplating: Go Templates & Sprig
Answer
toYaml serializes a value (map, list, scalar) as YAML text. It is the standard way to pass through whole blocks the chart does not want to model field by field: resources, securityContext, affinity, tolerations, nodeSelector, extra volumes.
securityContext:
{{- toYaml .Values.api.securityContext | nindent 12 }}
It also handles quoting of special strings correctly, unlike hand-written templates.
More on Templating: Go Templates & Sprig
What template language does Helm use?BeginnerWhat does the dot (`.`) mean in a Helm template?BeginnerWhat is `$` and when do you need it?IntermediateHow does whitespace control (`{{-` and `-}}`) work?BeginnerHow do `if`, `else if` and `else` evaluate truthiness?BeginnerWhat do `and`, `or`, `not`, `eq`, `ne`, `lt`, `gt` look like in Helm?Beginner