Repository navigation
Bump operators to k8s 0.36.5 and Go 1.26 - #5154
riadelhajjaji-scality wants to merge 5 commits into
Conversation
Hello riadelhajjaji-scality,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Foreign commits detected in source branchThe source branch
This typically happens when the feature branch was accidentally based on
How to fix Create a new branch directly from Then open a new pull request from that branch. If this is a false positive If your branch is a legitimate backport and was previously merged into one |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
|
/changie Enhanced |
|
|
||
| # Force Go toolchain version | ||
| export GOTOOLCHAIN = go1.24.13 | ||
| export GOTOOLCHAIN = go1.26.9 |
There was a problem hiding this comment.
go.mod refers to go 1.26.0, why using 1.26.9 here ?
There was a problem hiding this comment.
This is the same split we had before (go 1.24.0 in go.mod with GOTOOLCHAIN = go1.24.13)
Here the explaination:
-
The go directive(go 1.26.0 in go.mod) is the minimum Go version required to build the module, and since Go 1.21 it's a hard requirement that propagates to every module importing ours (go mod tidy bumps their go line to match). 1.26.0 is what the k8s.io 0.36 libraries require and we don't use anything introduced in later patches, so raising it to 1.26.9 would only force consumers (e.g. anyone importing the operator/api types) to upgrade for no benefit. This follows upstream convention: k8s.io and controller-runtime also declare x.y.0.
-
GOTOOLCHAIN = go1.26.9 in the Makefile is a different thing: it pins the exact compiler used to build our binaries, so builds are reproducible across dev machines and CI and include the latest security fixes (1.26.1 → 1.26.9). It has no effect on modules that depend on us.
|
|
||
| # Force Go toolchain version | ||
| export GOTOOLCHAIN = go1.24.13 | ||
| export GOTOOLCHAIN = go1.26.9 |
There was a problem hiding this comment.
Same comment as above
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
Branches have divergedThis pull request's source branch To avoid any integration risks, please re-synchronize them using one of the
Note: If you choose to rebase, you may have to ask me to rebuild |
|
36d63e7 to
cd29b57
Compare
|
LGTM |
| else: | ||
| log_warn(f" {key}: pinned {pinned} > detected {found}, using detected") | ||
| cfg[key] = found | ||
| log_warn(f" {key}: pinned {pinned} ahead of scaffold {found}, keeping pin") |
There was a problem hiding this comment.
The bot thread on this line was resolved, but found > pinned (l.332) is still a string compare. 'go1.26.10' > 'go1.26.9' is False, so we land here with pinned go1.26.9 ahead of scaffold go1.26.10 and never see the newer patch. The pin is kept either way, only the warning is wrong. Comparing the numbers fixes it (tested locally, black 26.3.1 OK):
elif tuple(map(int, re.findall(r"\d+", found))) > tuple(
map(int, re.findall(r"\d+", pinned))
):| go_toolchain: go1.26.9 | ||
| k8s_libs: v0.36.5 |
There was a problem hiding this comment.
nit: 220e15da4 only bumps these 2 lines, and the first commit already does the same for operator/config.yaml. I'd squash it into the first commit.
| def _minor(version: str) -> str: | ||
| """Return the `vX.Y` part of a `vX.Y.Z` version, or empty string.""" | ||
| m = re.match(r"(v\d+\.\d+)\.", version) | ||
| return m.group(1) if m else "" |
There was a problem hiding this comment.
nit: _latest_k8s_patch (l.239) has the same regex. Maybe use _minor() there too?
Bump, for both metalk8s-operator and storage-operator: - Go toolchain from go1.24.13 to go1.26.9 (`go 1.26.0` in go.mod, builder image golang:1.26) - k8s.io libraries (api, apimachinery, client-go) from 0.33.13 to 0.36.5 - controller-runtime from 0.21.0 to 0.24.1 - controller-tools (controller-gen) from v0.18.0 to v0.21.0 - golangci-lint from v2.1.0 to v2.14.0 - ginkgo from 2.22.0 to 2.27.4, gomega from 1.36.1 to 1.39.0, and indirect dependencies The go directive stays on 1.26.0, the minimum version required by the k8s.io 0.36 libraries, as it is imposed on modules importing ours. GOTOOLCHAIN pins the exact compiler used to build our binaries. The operators are regenerated with tools/upgrade-operator-sdk, the go_toolchain and k8s_libs pins are updated in both config.yaml. The CRDs and deploy/manifests.yaml only change the controller-gen version annotation and field descriptions inherited from the k8s.io 0.36 API types (e.g. Lt/Gt toleration operators behind a feature gate), there is no schema change. Refs: MK8S-343
…operator` to 0.36.5 (Go 1.26, `controller-runtime` 0.24.1) Auto-generated-by: changie-add-changelog
operator-sdk v1.42.3 still scaffolds k8s.io 0.33 and controller-runtime 0.21, so a k8s_libs or go_toolchain pin ahead of the scaffold was replaced by the scaffold version and the bump was lost. Keep the pinned value instead, and compare versions numerically, as a string compare sorts go1.26.10 before go1.26.9. Add optional controller_runtime, controller_tools and golangci_lint pins in config.yaml, controller-runtime having to follow the k8s.io libs minor. The Dockerfile builder image now follows go_toolchain. Refs: MK8S-343
Warn when the controller-runtime version (pinned or from the scaffold) requires a different k8s.io minor than `k8s_libs`, by reading its go.mod on the Go module proxy, so a k8s_libs bump cannot silently leave controller-runtime behind. Document in BUMPING.md that pins ahead of the scaffold are kept, the new controller_runtime, controller_tools and golangci_lint keys, and this check. Refs: MK8S-343
cd29b57 to
0614c75
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
| else: | ||
| log_warn(f" {key}: pinned {pinned} > detected {found}, using detected") | ||
| cfg[key] = found | ||
| log_warn(f" {key}: pinned {pinned} ahead of scaffold {found}, keeping pin") |
There was a problem hiding this comment.
With pins ahead of the scaffold, this branch is now the normal path, and the "newer patch available" warning can no longer fire for go_toolchain/k8s_libs: detect_latest_patches only looks up the latest patch of the scaffold minor (go1.24 / v0.33), so a go1.26.10 or v0.36.6 release is never reported. Consider detecting the latest patch of the pinned minor here (e.g. call _latest_go_patch/_latest_k8s_patch on the pin) and warning if it is newer.
— Claude Code
|
The latest Go and k8s.io patches are looked up for the scaffold minor only (go1.24, v0.33). With go_toolchain and k8s_libs pinned ahead of the scaffold, a newer patch of the pinned minor (e.g. go1.26.10) was never reported. Look it up too and warn when it is newer than the pin. The pin is still used. Refs: MK8S-343
|
✅ Changelog check passed. |
|
LGTM |
Component: operator, storage-operator, build
Context:
metalk8s-operatorandstorage-operatorare built with Go 1.24,k8s.io libraries 0.33.13 and
controller-runtime0.21.0. Theseversions are getting old (Go 1.24 is out of support), and keeping
them up to date eases future Kubernetes upgrades.
The operators are regenerated with
tools/upgrade-operator-sdk(operator-sdk v1.42.3), but this operator-sdk scaffolds older
k8s.io libraries and
controller-runtime, so the script needs tokeep versions pinned ahead of the scaffold.
Summary:
metalk8s-operatorandstorage-operator:go 1.26.0ingo.mod,builder image
golang:1.26)api,apimachinery,client-go) from0.33.13 to 0.36.5
controller-runtimefrom 0.21.0 to 0.24.1controller-tools(controller-gen) from v0.18.0 to v0.21.0golangci-lintfrom v2.1.0 to v2.14.0ginkgo2.22.0 -> 2.27.4,gomega1.36.1 -> 1.39.0, andindirect dependencies
deploy/manifests.yaml: only thecontroller-genversion annotation and field descriptionsinherited from the new k8s.io API types change (e.g.
Lt/Gttoleration operators behind a feature gate), no schema change
tools/upgrade-operator-sdk/upgrade.py:config.yamlwhen it is ahead of whatoperator-sdk scaffolds, instead of falling back to the scaffold
version
controller_runtime,controller_toolsandgolangci_lint,controller-runtimebeing pinned together withthe k8s.io libraries, as both must share the same minor
(e.g.
go1.26.9->golang:1.26)Acceptance criteria:
installation, expansion, upgrade and downgrade tests
(
ClusterConfig,VirtualIPPool,Volume) on a clustertools/upgrade-operator-sdk/upgrade.pyregenerates both operatorswith no diff from this PR
Closes: #MK8S-343
Note:
These libraries target Kubernetes 1.36, this should be merged after
the Kubernetes 1.36 bump (#5146).