Is it possible to redefine an array in helm values.yaml?
In the values.yaml I have among other top level values one of like this:
attribute:
component1:
type: Type1
component2:
type: Type2
In the templates it is used this way:
{{- $key := "component1" }}
{{- if .Values.attribute }}
{{- $profile := .Values.attribute }}
{{- if hasKey .Values.attribute $key }}
{{- $profile = index .Values.attribute $key }}
{{- end -}}
{{ if $profile.type }}
...
I would like to achive by helm template --set (or any other means) that I set the "type" on the common level and remove all of the component level ones together with the components themselves. So the rest of the values should remain the same, but the result regarding the "attribute" should be:
attribute:
type: MyType
I've tried:
helm template --set attribute.type=MyType
But this would just add this new element to the "attribute" array beside the components.
helm templates --set "attribute={type: MyType}"
But this fails as the attribute is now a list instead of the expected map[string].