image.tag of all numbers causes Helm to interpret as Scientific Notation
I am using the Git short SHA as the tag for my container images. Sometimes, when the SHA consists of all numbers, it causes a deployment error in Kubernetes.
For example, one of my recent commits in a project had a short SHA of 45528369
. If I describe the pod that is trying to deploy, you can see that Helm is causing it to be interpreted as scientific notation (some names changed for privacy):
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled <unknown> default-scheduler Successfully assigned my-app-3-review-controller-gqj0ke/review-controller-gqj0ke-6598dc6f5-st6cq to pool-some-pool-3cqjk
Warning InspectFailed 3m11s (x8 over 3m32s) kubelet, pool-some-pool-3cqjk Failed to apply default image tag "registry.my-domain.net/my-project/my-app:4.5528369e+07": couldn't parse image reference "registry.my-domain.net/my-project/my-app:4.5528369e+07": invalid reference format
Normal SandboxChanged 3m10s (x8 over 3m32s) kubelet, pool-some-pool-3cqjk Pod sandbox changed, it will be killed and re-created.
Warning Failed 3m8s (x9 over 3m32s) kubelet, pool-some-pool-3cqjk Error: InvalidImageName
The error is here -> couldn't parse image reference "registry.my-domain.net/my-project/my-app:4.5528369e+07": invalid reference format.
Apparently, this has been a pretty common issue with Helm: https://github.com/helm/helm/issues/1707
One suggestion was to change --set
to --set-string
. Perhaps that could be done at the following:
- https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/blob/master/src/bin/auto-deploy#L293
- https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/blob/master/src/bin/auto-deploy#L333
I wouldn't mind making a merge request if that seems like the proper way to fix the problem. I'm fairly new at k8s and Helm, so that may not be the true problem! :)