Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.
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

Closed

Description

@chenzhiwei

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.

Is there a way to handle such case?

Activity

  1. mattfarina commented on Dec 12, 2017

    @mattfarina
    Contributor

    @chenzhiwei A couple things...

    1. You might want to ask this question on helm as this is a feature of helm. You may get more to your answer there.
    2. 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.

    Why would v1.10.1 cause an unexpected behavior?

  2. chenzhiwei commented on Dec 12, 2017

    @chenzhiwei
    ContributorAuthor

    @mattfarina In string compare, v1.10.1 is less than v1.8.1, but actually not.

  3. mattfarina commented on Dec 13, 2017

    @mattfarina
    Contributor

    We should start to use the semver functions instead of string comparison ones. See https://masterminds.github.io/sprig/semver.html

  4. mattfarina commented on Dec 18, 2017

    @mattfarina
    Contributor

    /kind bug
    /lifecycle frozen

  5. added
    lifecycle/frozen
    kind/bug
    on Dec 18, 2017
  6. mattfarina commented on Jan 2, 2018

    @mattfarina
    Contributor
  7. self-assigned this
    on Jan 2, 2018
  8. mattfarina commented on Jan 2, 2018

    @mattfarina
    Contributor

    We need to go through the charts and fix this prior to 1.10 and we'll need to document this.

  9. mattfarina commented on Jan 30, 2018

    @mattfarina
    Contributor

    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.

  10. ReSearchITEng commented on Mar 30, 2018

    @ReSearchITEng
    Contributor

    Just migrated to k8s 1.10 and this si critical. Many issues in all charts due to this compare, including nginx-ingress.

  11. ReSearchITEng commented on Mar 30, 2018

    @ReSearchITEng
    Contributor
  12. ReSearchITEng commented on Mar 30, 2018

    @ReSearchITEng
    Contributor

    I confirm the newly fixed nginx-ingress 0.12.2 works fine.

  13. ReSearchITEng commented on Mar 30, 2018

    @ReSearchITEng
    Contributor

    By searching for KubeVersion in all charts shows 14 charts affected by this issue.

  14. 31 remaining items

  15. removed
    kind/bug
    lifecycle/frozen
    on Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions