Failure if ConfigMap contains a stringified json array
mitmitmitm opened this issue · 3 comments
mitmitmitm commented
If a helm chart contains
apiVersion: v1
kind: ConfigMap
metadata:
name: datasources-json
data:
default-datasources.json.template: |
[
{
"name": "virtu",
"type": "foo"
},
{
"name": "foolist",
"type": "bar"
}
]
helm images get
fails with
$ helm images get -l debug ./helm-chart
{"level":"debug","msg":"looks like no release name specified, hence it would be set to 'sample' by default","time":"2024-03-13T08:29:00+01:00"}
{"level":"debug","msg":"got all required values to fetch the images from chart/release 'sample' proceeding furter to fetch the same","time":"2024-03-13T08:29:00+01:00"}
{"level":"debug","msg":"fetching manifests for 'sample' by rendering helm template locally","time":"2024-03-13T08:29:00+01:00"}
{"level":"debug","msg":"rendering helm chart with following commands/flags 'template, sample, ./helm-chart, --set, global.keycloak.address=example.cm, --debug'","time":"2024-03-13T08:29:00+01:00"}
{"level":"debug","msg":"running following command to render the helm template: /usr/local/bin/helm template sample ./helm-chart --set global.keycloak.address=example.cm --debug","time":"2024-03-13T08:29:00+01:00"}
{"level":"debug","msg":"splitting helm manifests with regex pattern: '---\\n# Source:\\s.*.'","time":"2024-03-13T08:29:00+01:00"}
{"level":"debug","msg":"either helm-images plugin does not support kind 'Secret' at the moment or manifest might not have images to filter","time":"2024-03-13T08:29:00+01:00"}
{"level":"debug","msg":"either helm-images plugin does not support kind 'Secret' at the moment or manifest might not have images to filter","time":"2024-03-13T08:29:00+01:00"}
{"level":"debug","msg":"fetching images from kind 'ConfigMap'","time":"2024-03-13T08:29:00+01:00"}
Error: json: cannot unmarshal array into Go value of type map[string]interface {}
2024/03/13 08:29:00 cmd.go:22: json: cannot unmarshal array into Go value of type map[string]interface {}
Error: plugin "images" exited with error
Helm images version: {"version":"0.1.3","revision":"2f7926e1f7461e2819e39fff2b04a3cf5dfcac8e","environment":"production","build-date":"2024-03-12T04:14:40Z","go-version":"go1.22.0","platform":"linux/amd64"}
nikhilsbhat commented
@mitmitmitm, is this happening only with latest version of the plugin?
mitmitmitm commented
Yes, only in latest. I tried with version v0.1.2, and it worked fine.
nikhilsbhat commented
@mitmitmitm, Thanks for reporting the issues. It looks like there is a bug with the newer feature of identifying images in ConfigMap. I'll look into this.