Custom RKE2 | Unexpected Sorting of K8s Version | Blocking Upgrade
Setup
- Rancher version: 2.6.3-rc5
- Browser type & version: Google Chrome 96.0.4664.55 (Official Build) (x86_64)
Describe the bug
When creating a Custom RKE2 cluster there is a k8s version not being sorted as an expected. When trying to upgrade the cluster from v1.21.7rke2r2 to v1.21.7-rc2+rke2r3. The v1.21.7-rc2+rke2r3 version is greyed out and unable to be selected.
v1.21.7-rc2+rke2r3 is > v1.21.7rke2r2
To Reproduce
- Create a custom RKE2 cluster with
v1.21.7rke2r2 - Try to upgrade the custom RKE2 cluster from
v1.21.7rke2r2tov1.21.7-rc2+rke2r3
Result
v1.21.7-rc2+rke2r3 is sorted after v1.21.7rke2r2. When trying to upgrade the cluster the v1.21.7-rc2+rke2r3 is disabled and unavailable to select as an upgrade option.
Expected Result
To be able to upgrade from v1.21.7rke2r2 to v1.21.7-rc2+rke2r3
Screenshots

Additional context
The UI is making these sortable with utils/sort as:
v1.21.7rke2r2 = 0000000001.0000000021.0000000007.rke0000000002r0000000002
v1.21.7-rc2+rke2r3 = 0000000001.0000000021.0000000007.rc0000000002.rke0000000002r0000000003
This is the correct behavior, 1.21.7-anything is by (semver) definition less than 1.21.7. They are the same major/minor/patch, adding a hyphen makes it a prerelease, and all prereleases are less than the same tag without a prerelease. The -rcX should go after the + so that it is part of the metadata instead of a prerelease marker.
The extending out the numbers thing with lots of leading zeros is not relevant to this, that just makes it so that the standard string sort (which is a lot faster than providing a custom one) will preserve lexographic ordering of numbers (i.e. 1, 2 ... 10, 11, 12) instead of 'ASCII-betical' order (1, 10, 11, 12, 2, 3 ...)
I need to file an RKE2 ticket to fix semver.
Filed https://github.com/rancher/rke2/issues/2272 to address semver.
In light of the current state of the versions listed, independent of this UI issue, we'll push this out to 2.6.4.
New backend ticket for more Team 2 tracking: https://github.com/rancher/rancher/issues/39303
Tracking now back to RKE2 repo: https://github.com/rancher/rke2/issues/2272 as the other backend ticket was closed as a duplicate.
Pushing to Q4 as Q3 timeline is tight. Will check with RKE2 team about plans.
Per @caroline-suse-rancher, a hyphen should never be in a release in the UI for rke2 anymore.
"For more explanation, if we re-release a version it is always an r2, r3, etc. in the case of rke2 and an s2, s3, etc. in the case of k3s. So, for instance, if we have the first release of v1.24.16+rke2r1, then need to re-release it would become v1.24.16+rke2r2 , rc stands for "release candidate", so it should never be shipped with the official release."
@brudnak This is and old issue - is this still relevant?
@brudnak This is and old issue - is this still relevant?
From these comments, https://github.com/rancher/dashboard/issues/4776#issuecomment-1645977267, and https://github.com/rancher/dashboard/issues/4776#issuecomment-995180030 think you can close this issue @nwmac
based on Andrew's comment, will close this issue.
FYI @nwmac @gaktive