You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When setting a value such as --set image.tag=3213841, it gets interpreted as a numeric value and comes out of {{ .Values.image.tag }} looking like 3.213841e+06 in the rendered yaml.
This can be worked around, but in a pretty ugly way, by adding a non-numeric character to the value being set so that this fails to parse as a number and then later on, strip out the extraneous characters in the template. For example:
This was partially addressed in #2693, in the case where the number has a leading 0, but is still problematic in this case.
What I'm wondering is if there is a reason to try typing values at all or if leaving them as a string would be the more unsurprising behaviour.
For background, this issue came up because I use git short hashes as image tags. Most of the time they include non-numeric chars so work fine. Also, when using values from a file, they can be quoted, thus avoiding the problem. The only time it came up was when using --set which has no easy way to force value type.
This continues to be a problem. In addition, I've tried passing --set image.tag='!!str 3213841' and --set 'image.tag=!!str 3213841' using explicit string typing, without remedy, it becomes interpolated as image: tag: '!!str 3213841' in the computed values.
Activity
jiacona commentedon Nov 16, 2017
ping @thomastaylor312
thomastaylor312 commentedon Nov 16, 2017
Thanks for opening this @jiacona
rpsec commentedon Feb 2, 2018
@jiacona Does this still happen if you use 'quote' ?
Example:
" {{ .Values.image.tag | quote }}"
jiacona commentedon Feb 5, 2018
@rprobotics yes. The type casting must happen before interpolation in the template, because when using
quoteyou still get a formatted number.jesselang commentedon Feb 12, 2018
This continues to be a problem. In addition, I've tried passing
--set image.tag='!!str 3213841'and--set 'image.tag=!!str 3213841'using explicit string typing, without remedy, it becomes interpolated asimage: tag: '!!str 3213841'in the computed values.arturo-c commentedon Mar 21, 2018
@thomastaylor312 this one can probably be closed , thanks for approving #3599