Sprig dict: Difference between revisions
Jump to navigation
Jump to search
Line 14: | Line 14: | ||
<syntaxhighlight lang='yaml'> | <syntaxhighlight lang='yaml'> | ||
{{- $ExampleDict := dict "key1" "value1" "key2" $OtherVar -}} | {{- $ExampleDict := dict "key1" "value1" "key2" $OtherVar -}} | ||
</syntaxhighlight> | |||
Adding a key/value pair: | |||
<syntaxhighlight lang='yaml'> | |||
{{- $_0 := set $ExampleDict "key2" "value3" -}} | |||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 03:16, 8 October 2020
External
Internal
Overview
A dict instance is used as the root scope by Helm while rendering templates. dict instances can also be used to pass arguments to sub-templates:
Helm Patterns
Creating a dict:
{{- $ExampleDict := dict -}}
{{- $ExampleDict := dict "key1" "value1" "key2" $OtherVar -}}
Adding a key/value pair:
{{- $_0 := set $ExampleDict "key2" "value3" -}}