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
{{ message }}
This repository was archived by the owner on Feb 22, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 22, 2022. It is now read-only.
string compare of version number may lead to unexpected behavior #3002
When I build Kubernetes, I added a suffix to the version string such as v1.8.3-xxx which leads the versionInfo Minor is 8+. (I already export KUBE_GIT_MINOR=8 before compiling Kubernetes, but the Minor version is still 8+)
I checked some of the charts, they are using string compare of the versionInfo, like following:
{{- if and (eq .Capabilities.KubeVersion.Major "1") (gt .Capabilities.KubeVersion.Minor "7") }}
But when Kubernetes version is upgraded to v1.10.1, so the string compare may lead to unexpected behavior.
You might want to ask this question on helm as this is a feature of helm. You may get more to your answer there.
Have you tried using a version like v1.8.3+xxx instead? In semantic versioning the - is the separator for a prerelease while the + is the separator to distinguish the same version but a different build (consider the + the separator for build metadata). Note, I've not tested this myself so I'd be curious if you do and have feedback.
I tested latest nginx-ingress (nginx-ingress-0.11.3) few hours back, and I
can confirm it was not ok.
More exactly, controller.service.externalTrafficPolicy=Local is not
getting set on a k8s 1.10 cluster, while works perfectly on a 1.9.6.
Checking the helm chart, the issue comes from the comparison of versions.
Activity
mattfarina commentedon Dec 12, 2017
@chenzhiwei A couple things...
v1.8.3+xxxinstead? In semantic versioning the-is the separator for a prerelease while the+is the separator to distinguish the same version but a different build (consider the+the separator for build metadata). Note, I've not tested this myself so I'd be curious if you do and have feedback.Why would
v1.10.1cause an unexpected behavior?chenzhiwei commentedon Dec 12, 2017
@mattfarina In string compare,
v1.10.1is less thanv1.8.1, but actually not.mattfarina commentedon Dec 13, 2017
We should start to use the semver functions instead of string comparison ones. See https://masterminds.github.io/sprig/semver.html
mattfarina commentedon Dec 18, 2017
/kind bug
/lifecycle frozen
mattfarina commentedon Jan 2, 2018
/cc @kubernetes/charts-maintainers
An example of this problem at https://play.golang.org/p/u6mKXex4O7_y
mattfarina commentedon Jan 2, 2018
We need to go through the charts and fix this prior to 1.10 and we'll need to document this.
mattfarina commentedon Jan 30, 2018
Note, what we need for this is in Helm 2.8 but there is a pending bug to deal with prior to upgrading to that. This is still tracking.
ReSearchITEng commentedon Mar 30, 2018
Just migrated to k8s 1.10 and this si critical. Many issues in all charts due to this compare, including nginx-ingress.
ReSearchITEng commentedon Mar 30, 2018
ReSearchITEng commentedon Mar 30, 2018
I confirm the newly fixed nginx-ingress 0.12.2 works fine.
ReSearchITEng commentedon Mar 30, 2018
By searching for KubeVersion in all charts shows 14 charts affected by this issue.
31 remaining items
Fix for version comparison from strings to semver (helm#4606)
Fix for version comparisons from strings to semver (helm#4607)
Fix for version comparison from strings to semver (helm#4600)
Fix for version handling with stringe vs semver (helm#4597)
Fixing version range handling from strings to semver (helm#4598)
Fix for version comparions from strings to semver (helm#4599)
Fix for version comparison from strings to semver (helm#4605)
Fix for version comparison from strings to semver (helm#4603)
Fix for version comparison from strings to semver (helm#4602)
Fix for version comparison from strings to semver (helm#4608)
bridgetkromhout commentedon Jan 14, 2022
Today, Helm uses semver comparison: https://helm.sh/docs/topics/charts/#charts-and-versioning
If any questions remain, please open an issue in helm/helm: https://github.com/helm/helm/issues/new