chore: upgrade k8s.io/api and controller-runtime to support Kubernetes 1.32 API fields#336
chore: upgrade k8s.io/api and controller-runtime to support Kubernetes 1.32 API fields#336LittleChimera wants to merge 4 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @LittleChimera! It looks like this is your first PR to openkruise/rollouts 🎉 |
- test/e2e/rollout_test.go:1785: HeaderMatchRegularExpression moved from gatewayv1beta1 to gatewayv1 in gateway-api v1.x; the pkg/ tree was already migrated in openkruise#336 but this e2e site was missed - Makefile CONTROLLER_GEN_VERSION: v0.14.0 -> v0.17.2 to match the CRD files committed in openkruise#336 (annotation says v0.17.2); otherwise make manifests in CI re-generates with v0.14.0 and the cleanliness check `[[ -z $(git status -s) ]]` fails - Makefile ENVTEST_K8S_VERSION: 1.28.0 -> 1.32.0 to match the k8s.io v0.32.3 bump
|
Hi @LittleChimera , thanks for tackling this upgrade — really useful work. I validated this PR on a fork while preparing some downstream gateway-api changes and found three small fixes that get the GitHub Actions checks green:
Branch with all three fixes on top of this PR's HEAD: GitHub Actions run (golangci-lint + unit-tests both ✅): The fix commit (4 lines changed across 2 files): Happy to open a separate PR if you'd prefer that workflow, or feel free to cherry-pick directly into this branch — whichever is easier for you. Thanks again for driving the upgrade! |
|
Thanks @OrangeSnoopy — all three fixes applied in 1e22c77:
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #336 +/- ##
==========================================
- Coverage 51.38% 45.25% -6.14%
==========================================
Files 66 95 +29
Lines 8559 10092 +1533
==========================================
+ Hits 4398 4567 +169
- Misses 3575 4898 +1323
- Partials 586 627 +41
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes openkruise#335 — the webhook was silently dropping fields introduced in Kubernetes 1.29+ (e.g. lifecycle.preStop.sleep / SleepAction) because it round-tripped Deployment objects through k8s.io/api v0.28 Go structs, which do not include those fields. Upgraded modules: - k8s.io/api, apimachinery, client-go, apiextensions-apiserver, apiserver, component-base: v0.28.9 → v0.32.3 - sigs.k8s.io/controller-runtime: v0.16.6 → v0.20.4 - sigs.k8s.io/gateway-api: v0.8.1 → v1.2.1 Code changes required by the API migration: - source.Kind() is now generic; handler is passed inline, not to c.Watch - admission.Decoder is now an interface (drop the pointer indirection) - Event handler methods use typed event/queue signatures - HTTPRoute and match-type constants graduated from v1beta1 to v1 in gateway-api v1.x - workqueue.NewTypedRateLimitingQueue used in tests for typed queues - Test hash constants updated to reflect struct-level changes in v0.32 (ComputeHash uses spew over the full struct; new zero-value fields in PodTemplateSpec change the digest) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Luka Skugor <luka.skugor@chimeramail.com>
- Bump GO_VERSION 1.20 → 1.23 in CI (required by k8s.io/api v0.32 / controller-runtime v0.20) - Regenerate CRD manifests and RBAC role via make generate manifests (new k8s API fields in PodTemplateSpec affect generated output) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Luka Skugor <luka.skugor@chimeramail.com>
- Use gatewayv1.HeaderMatchRegularExpression in e2e test (const removed from v1beta1 in gateway-api v1.x) - Bump CONTROLLER_GEN_VERSION v0.14.0 → v0.17.2 to match committed CRD annotations - Bump ENVTEST_K8S_VERSION 1.28.0 → 1.32.0 to match k8s.io v0.32.3 upgrade Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Luka Skugor <luka.skugor@chimeramail.com>
go.mod requires go 1.23.0 (set by the k8s v0.32 upgrade) but the Dockerfiles used golang:1.20/1.19 which reject 3-part go directives. All 30 e2e workflow files also had GO_VERSION pinned to 1.20. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Luka Skugor <luka.skugor@chimeramail.com>
1e22c77 to
1f9b42a
Compare
Summary
Fixes #335
The webhook was silently dropping Kubernetes API fields introduced after 1.28 (e.g.
lifecycle.preStop.sleep/SleepActionintroduced GA in 1.30) because it round-trippedDeploymentobjects throughk8s.io/api v0.28Go structs. Any field not present in the 1.28 struct definition was invisible to the webhook and therefore absent from its mutation patch.Upgraded modules:
k8s.io/api,apimachinery,client-go,apiextensions-apiserver,apiserver,component-base: v0.28.9 → v0.32.3sigs.k8s.io/controller-runtime: v0.16.6 → v0.20.4sigs.k8s.io/gateway-api: v0.8.1 → v1.2.1Code changes
Required by the API migration in controller-runtime v0.20:
source.Kind()is now generic; the event handler is passed inline rather than as a second argument toc.Watchadmission.Decoderbecame an interface (removed pointer indirection on struct fields)TypedCreateEvent[client.Object],TypedRateLimitingInterface[reconcile.Request], etc.)HTTPRouteand match-type constants (HeaderMatchRegularExpression, etc.) graduated fromv1alpha2/v1beta1tov1in gateway-api v1.xTest fixes:
workqueue.NewRateLimitingQueuewithworkqueue.NewTypedRateLimitingQueue[reconcile.Request]in unit testsComputeHashdigests that changed becausePodTemplateSpecgained new zero-value fields in v0.32 (spew serialises the full struct, so new fields shift the FNV-32a digest)Test plan
go build ./...— cleango test ./pkg/...— all pass🤖 Generated with Claude Code