I think I am misunderstanding something about how pipelining and the like works in templating for helm/golang. Helm version:
version.BuildInfo{Version:"v3.5.2", GitCommit:"167aac70832d3a384f65f9745335e9fb40169dc2", GitTreeState:"dirty", GoVersion:"go1.15.7"}
Given values.yaml:
base_dict:
one-thing:
some-setting: potato
two-thing:
some-setting: spud
and configmap.yaml:
apiVersion: v1
kind: ConfigMap
metadata:
name: some-map
data:
my_setting: {{ values .Values.base_dict | pluck "some-setting" | join "," }}
{{/* my_setting2: {{ pluck "some-setting" (values .Values.base_dict) | join "," }}*/}}
my expectation would be that my_setting would be: potato,spud or spud,potato, but instead I get an error:
helm.go:81: [debug] template: /path/to/file:6:50: executing "/path/to/file" at <"some-setting">: wrong type for value; expected map[string]interface {}; got []interface {}
It seems like it is expecting multiple dictionaries instead of a list of dictionaries, but I am not sure how to expand this for pluck?
The end goal was to get
some_setting(Changed the name from the original due to - vs _ in helm variable names) from the list of dictionaries, and to that goal, I made a helper in my_helpers.tpl:And then in my template:
To be clear, this is some pretty garbage stuff, but was the best I could come up with. Happy to entertain other options of course!