Skip to content

Instantly share code, notes, and snippets.

@mitzen
Created May 10, 2023 09:47
Show Gist options
  • Save mitzen/893d5d4eb46131d5b5ecc3834027deac to your computer and use it in GitHub Desktop.
Save mitzen/893d5d4eb46131d5b5ecc3834027deac to your computer and use it in GitHub Desktop.
{{- $default := dict "boolProp" true "stringProp" "Override me" }}
{{- $explicit := dict "boolProp" false "stringProp" "String value is overriden, but bool value is not!" }}
$default:
{{- $default | toYaml | nindent 2 }}
$explicit:
{{- $explicit | toYaml | nindent 2 }}
# Here is the bug: `boolProp` can't be overriden with a `false` value by
# `merge`. `boolProp` should be false here (the first argument to `merge` has
# precedence, according to helm docs)
merge $explicit $default:
{{- merge $explicit $default | toYaml | nindent 2 }}
# `mergeOverwrite` also cannot deal with bools
mergeOverwrite $default $explicit:
{{- mergeOverwrite $default $explicit | toYaml | nindent 2 }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment