Can't parse long numeric string as value with Helm

1/31/2018

I want to set docker image repository and tag values from outside with --set. In my deployment manifest yaml file I wrote:

image: "{{ .Values.image.awesomeapp.repository }}:{{ .Values.image.awesomeapp.tag | quote }}"

And run Helm this way:

helm install charts/awesomeapp \
    --set image.awesomeapp.repository=1234567890.dkr.ecr.ap-northeast-1.amazonaws.com/awesomeapp \
    --set image.awesomeapp.tag=20180131010101

But failed:

Failed to apply default image tag "1234567890.dkr.ecr.ap-northeast-1.amazonaws.com/awesomeapp:\"2.01801310101013e+13\"": couldn't parse image reference "1234567890.dkr.ecr.ap-northeast-1.amazonaws.com/orange-battle:\"2.01801310101013e+13\"": invalid reference format

Why it can’t pause image tag correctly?

-- online
docker
image
kubernetes-helm
repository
tags

1 Answer

3/24/2018

It is a helm bug:

helm install --set tag=20161216 ends up in scientific notation in the template and that's because {{ typeOf .Value.tag }} yields float64.

It is already fixed and Adding --set-string flag to force string values pull request is merged. So new flag --set-string will be added to helm some time later.

If you had to use old version helm, there could be the following workaround:

1. Deployment manifest yaml file should be changed to:

image: {{ .Values.image.awesomeapp.repository }}:{{ .Values.image.awesomeapp.tag | replace ":" "" }}

2. We need to define this extra symbol : before the value with --set:

helm install charts/awesomeapp \
    --set image.awesomeapp.repository=1234567890.dkr.ecr.ap-northeast-1.amazonaws.com/awesomeapp \
    --set image.awesomeapp.tag=:20180131010101
-- nickgryg
Source: StackOverflow