kustomize: edit set image does not quote tags that will become non-string values in YAML

The kustomize edit set image command sets newTag it does not quote it when necessary to ensure it remains a string.

I use hashes for tag names and by random chance I ended up with one starting with 0e. Because in YAML this is considered a number rather than a string my deployments were silently not actually deploying.

This will be an issue for other people if their could tags look like numbers, booleans, etc…

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

It’s an issue in the wild.

I tag my docker images with git rev-parse --short=8 HEAD. Yesterday I got 706798e8 which was parsed as a number by kustomize.

Please help fix this minor yet annoying issue. 😢

Tested with kustomize v3.8.1.

$ kustomize edit set image foobar=foobar:706798e8
$ cat kustomization.yml
apiVersion: kustomize.config.k8s.io/v1beta1                                                                                                                                                                      kind: Kustomization
images:
- name: foobar
  newName: foobar
  newTag: "706798e8"
...

I guess this bug is fixed by kyaml.