fluxcd / flux

Successor: https://github.com/fluxcd/flux2
https://fluxcd.io
Apache License 2.0
6.9k stars 1.08k forks source link

Flux incorrectly parsing Clusterscaler image tag from 1.20 as 1.2 #3547

Closed infa-bapa closed 3 years ago

infa-bapa commented 3 years ago

Describe the bug

Am upgrading the clusterautoscaler in one of the cluster which follows flux flow.

So as excepted we have merged the config in git repo and flux started to upgrade the cluster autoscaler.

But we found some strange thing happened. In gitrepo ( Attached the Screenshot - Gitrepo config ) we have mentioned the image tag as "1.20", but in the deployment we see that's not the same, it is "1.2"( Attached the screenshot - Deployment config ).

Due to that the clusterautoscaler pod went to crashloopback.

Steps to reproduce

  1. Run flux:1.20.2
  2. Run helm-operator:1.2.0
  3. Try to install clusterautoscaler with version 1.20 through helm, chart version is 9.10.3

Expected behavior

Clusterautoscaler should be running with version 1.20 as mentioned in git repo instead of 1.2

Screenshots and recordings

Gitrepo config: image

Deployment config: image

Pod Event: image

OS / Distro

Linux

Flux version

1.20.2

Flux check

N/A

Git provider

No response

Container Registry provider

No response

Additional context

No response

Code of Conduct

bigkevmcd commented 3 years ago

I suspect this is a YAML issue, try forcing the 1.20 to be a string by enclosing it in quotes.

kingdonb commented 3 years ago

That's correct, 1.20 is being parsed as a number and there it becomes 1.2.

values:
  image:
    repository: ...
    tag: "1.20"

These are not proper semver either, as semver release tags must have three parts, a MAJOR, MINOR, and PATCH number, but unless you are using Image Update Automation this probably doesn't matter. I'm not sure you have any control over the image tags anyway, I only mention this because proper semver image tags with three parts have the advantage that they will never get accidentally parsed into a decimal number.

If you are setting the image repo and tag version manually in the HelmRelease, and it only has two parts, you need to quote it to prevent the YAML from parsing it into a decimal number. and dropping the trailing zero.

kingdonb commented 3 years ago

Please let us know if you're still having trouble with this! Closing.