helm-images icon indicating copy to clipboard operation
helm-images copied to clipboard

Error converting YAML to JSON

Open steven-sheehy opened this issue 9 months ago • 6 comments

The images plugin doesn't seem to work with my Helm chart.

$ helm repo add hedera https://hashgraph.github.io/hedera-mirror-node/charts
$ helm images get hedera/hedera-mirror
Error: deserializing yaml data of configmap errored with 'error converting YAML to JSON: yaml: line 3: did not find expected alphabetic or numeric character'
2024/05/14 22:52:24 cmd.go:22: deserializing yaml data of configmap errored with 'error converting YAML to JSON: yaml: line 3: did not find expected alphabetic or numeric character'
Error: plugin "images" exited with error

steven-sheehy avatar May 15 '24 03:05 steven-sheehy

@steven-sheehy , I'm uncertain about the contents of the configmap in your Helm chart. You might consider skipping that particular configmap using the --skip flag. You can find usage examples in the cli documentation here. Do let me know if that works.

nikhilsbhat avatar May 15 '24 06:05 nikhilsbhat

Which configmap? It's a wrapper chart so there's quite a few. It would be nice if the error printed which file it failed on or the contents that are having the problem.

This chart installs via helm successfully for many years so not sure why the error when using the plugin. Would be nice if it supported this chart without workarounds. Will see if I can use --skip to workaround the problem for now.

steven-sheehy avatar May 15 '24 14:05 steven-sheehy

@steven-sheehy , I'm unsure about the specific config-map causing the issue. The logs indicate an error related to a config-map. Enabling --log-level to debug might provide more insight into the name of the problematic config-map.

In the meantime, I'll work on enhancing the error message to include more detailed information about the config-map involved.

nikhilsbhat avatar May 15 '24 14:05 nikhilsbhat

Detecting images specified within a config-map can be challenging (since there's no standardisation in here, any type of data can be included here), but it's essential to have support for it as an add-on feature. Therefore, I've incorporated this functionality. However, bypassing config-map using the skip option remains the only viable choice.

nikhilsbhat avatar May 15 '24 14:05 nikhilsbhat

Thanks for the --log-level=debug hint. That helped me to figure out that it's sample-redis-health, which is a configmap provided by a 3rd party chart we're using. Skipping that file allows the plugin to proceed successfully.

$ helm images get hedera/hedera-mirror --skip 'configmap=sample-redis-health'
gcr.io/mirrornode/hedera-mirror-grpc:0.103.0
gcr.io/mirrornode/hedera-mirror-importer:0.103.0
gcr.io/mirrornode/hedera-mirror-monitor:0.103.0
docker.io/bitnami/pgpool:4.5.1-debian-12-r0
gcr.io/mirrornode/hedera-mirror-rest:0.103.0
gcr.io/mirrornode/hedera-mirror-rest-monitor:0.103.0
gcr.io/mirrornode/hedera-mirror-web3:0.103.0
docker.io/bitnami/postgresql-repmgr:14.11.0-debian-12-r8
docker.io/bitnami/redis:7.2.4-debian-12-r9
docker.io/bitnami/redis-sentinel:7.2.4-debian-12-r7
busybox:latest
bats/bats:1.11.0
postman/newman:6.1.1-alpine

I don't really need image support in configmaps personally. Perhaps just make it so that such error doesn't fail the plugin, logs a warning about the problem file, then it can proceed to extract images from the remaining files on a best effort basis?

steven-sheehy avatar May 15 '24 14:05 steven-sheehy

Logging errors without failing does seem logical. I'll consider this as feedback and work on it.

nikhilsbhat avatar May 15 '24 16:05 nikhilsbhat