Skip to content

chore: bump Go to 1.26 and Kubernetes dependencies to 1.36#2646

Open
rollandf wants to merge 1 commit into
Mellanox:masterfrom
rollandf:go1.26
Open

chore: bump Go to 1.26 and Kubernetes dependencies to 1.36#2646
rollandf wants to merge 1 commit into
Mellanox:masterfrom
rollandf:go1.26

Conversation

@rollandf

Copy link
Copy Markdown
Member

Upgrade the project to Go 1.26 and Kubernetes 1.36 (k8s.io/* v0.36.1), along with all tooling and API adaptations required by those bumps.

Go / module changes

  • go.mod: set go 1.26.0; upgrade k8s.io/* from v0.34.8 → v0.36.1, sigs.k8s.io/controller-runtime v0.22.5 → v0.24.1, and all transitive dependencies (klog, kube-openapi, prometheus, grpc, kustomize, …)

Makefile tooling

  • golangci-lint: v2.11.4 → v2.12.2 (first release that fully supports Go 1.26)
  • Add GO_MOD_VERSION variable and pass GOTOOLCHAIN=go$(GO_MOD_VERSION) to every go-install-tool invocation so tools are always built with the same Go version declared in go.mod, preventing the "build version lower than targeted version" error
  • controller-gen: v0.19.0 → v0.21.0 (k8s v0.36 / Go 1.26 aligned release)
  • setup-envtest: release-0.22 → release-0.24 (tracks controller-runtime v0.24)
  • ENVTEST_K8S_VERSION: 1.28 → 1.36

API / webhook changes

  • api/v1alpha1/groupversion_info.go: replace deprecated sigs.k8s.io/controller-runtime/pkg/scheme.Builder with k8s.io/apimachinery/pkg/runtime.NewSchemeBuilder; register all five CRD types centrally via addKnownTypes() and metav1.AddToGroupVersion()
  • api/v1alpha1/*_types.go: remove per-file init() SchemeBuilder.Register() calls now that registration is centralised
  • api/v1alpha1/validator/*_webhook.go: migrate from deprecated webhook.CustomValidator (Validator[runtime.Object]) to the typed admission.Validator[*ConcreteType] interface; update NewWebhookManagedBy(mgr, &Type{}) call (object moved from .For() to the constructor in controller-runtime v0.24); switch back to WithValidator() now that validators are properly typed; drop runtime.Object type assertions from each ValidateCreate/Update/Delete method

Bug fixes

  • pkg/nodeinfo/filter.go: update ToleratesTaint() call to the new k8s 1.36 signature (logger klog.Logger, taint *Taint, enableComparisonOperators bool); pass klog.Background() and true to preserve existing Lt/Gt operator behaviour
  • scripts/sosreport/kubectl-netop_sosreport: fix two component entries whose keys and label selectors were left as unresolved Go template placeholders ({{ }}) by generate-maps.sh; correct to name=network-operator-sriov-device-plugin and app=rdma-shared-dp
  • scripts/sosreport/kubectl-netop_sosreport: restore missing execute bit

@copy-pr-bot

copy-pr-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown

Greptile Summary

This PR upgrades the project to Go 1.26 and Kubernetes 1.36 (k8s.io/* → v0.36.1, controller-runtime → v0.24.1), adapting all API signatures and tooling required by those bumps.

  • Go/module changes: go.mod bumped to go 1.26.0; all k8s transitive dependencies updated; klog, kube-openapi, prometheus, grpc, and kustomize updated; a new GO_MOD_VERSION Makefile variable ensures all tooling (golangci-lint, controller-gen, setup-envtest) is built with the exact Go version declared in go.mod.
  • API/scheme registration: groupversion_info.go replaces the deprecated scheme.Builder with runtime.NewSchemeBuilder + a central addKnownTypes() that registers all five CRD types, removing per-type init() calls from each _types.go file.
  • Webhook migration: All three webhook validators migrate from the untyped webhook.CustomValidator (runtime.Object parameters) to the typed admission.Validator[*ConcreteType] interface, eliminating the now-unnecessary runtime type assertions; the NewWebhookManagedBy constructor call is updated to the new signature.
  • Taint filter fix: ToleratesTaint() updated to the new k8s 1.36 three-argument signature, passing klog.Background() and true to preserve pre-existing Lt/Gt operator behaviour.
  • Script fixes: Two component entries in kubectl-netop_sosreport that contained unresolved Go template placeholders ({{) are corrected, and the missing execute bit is restored.

Confidence Score: 5/5

This is a well-executed dependency upgrade; all API surface changes follow the new controller-runtime v0.24 contracts, scheme registration is complete and centralised, and the taint filter adapts the new three-argument signature with a deliberate choice that preserves pre-existing behaviour.

Every changed code path was verified: the typed webhook validators correctly implement the admission.Validator[T] interface without any remaining runtime.Object casts; the five CRD types are all registered in the new central addKnownTypes(); klog and the enableComparisonOperators flag are wired up as intended; the sosreport script template-placeholder bug and missing execute bit are fixed; and Makefile tooling is self-consistent. No logic errors, missing registrations, or broken contracts were found.

No files require special attention. The most behaviorally significant change is in pkg/nodeinfo/filter.go (taint toleration), which looks correct.

Important Files Changed

Filename Overview
api/v1alpha1/groupversion_info.go Replaces deprecated scheme.Builder with runtime.NewSchemeBuilder; centralises registration of all 5 CRD types via addKnownTypes(); correct and complete
api/v1alpha1/validator/hostdevicenetwork_webhook.go Migrated from untyped webhook.CustomValidator to typed admission.Validator[*HostDeviceNetwork]; runtime type assertions removed; NewWebhookManagedBy call updated correctly
api/v1alpha1/validator/nicpolicy_webhook.go Migrated both NicClusterPolicy and NicNodePolicy validators to typed admission.Validator[T]; errors import retained because it is still used for policy overlap validation; signatures correct
pkg/nodeinfo/filter.go ToleratesTaint() updated to new k8s 1.36 three-arg signature; klog.Background() and true passed to preserve pre-existing Lt/Gt behaviour; correct
Makefile ENVTEST_K8S_VERSION updated to 1.36; tool versions bumped (golangci-lint, controller-gen, setup-envtest); GO_MOD_VERSION variable added with GOTOOLCHAIN override to prevent version mismatch
scripts/sosreport/kubectl-netop_sosreport Fixed two component entries with unresolved Go template placeholders ({{ }}) in map keys and selectors; restored missing execute bit (mode 644→755)
go.mod Coherent dependency upgrade: Go 1.26.0, k8s.io/* v0.36.1, controller-runtime v0.24.1; klog promoted to direct dependency; several transitive packages removed/cleaned up

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph old["Before (controller-runtime v0.22)"]
        A1["ctrl.NewWebhookManagedBy(mgr)\n.For(&Type{}).WithValidator(v)"]
        B1["webhook.CustomValidator\nValidateCreate(ctx, runtime.Object)\nValidateUpdate(ctx, old, new runtime.Object)\nValidateDelete(ctx, runtime.Object)"]
        C1["Type-assert obj.(*ConcreteType)\nReturn error if fails"]
        A1 --> B1 --> C1
    end

    subgraph new["After (controller-runtime v0.24)"]
        A2["ctrl.NewWebhookManagedBy(mgr, &Type{})\n.WithValidator(v)"]
        B2["admission.Validator[*ConcreteType]\nValidateCreate(ctx, *ConcreteType)\nValidateUpdate(ctx, old, new *ConcreteType)\nValidateDelete(ctx, *ConcreteType)"]
        C2["No type assertion needed\nFramework injects typed object"]
        A2 --> B2 --> C2
    end

    subgraph scheme["Scheme Registration"]
        D1["Old: per-type init() in each _types.go\n -> SchemeBuilder.Register(&T{}, &TList{})"]
        D2["New: central addKnownTypes()\n -> s.AddKnownTypes(GroupVersion, all 5 types)"]
        D1 -.->|replaced by| D2
    end

    old -.->|migrated to| new
Loading

Reviews (2): Last reviewed commit: "chore: bump Go to 1.26 and Kubernetes de..." | Re-trigger Greptile

Upgrade the project to Go 1.26 and Kubernetes 1.36 (k8s.io/* v0.36.1),
along with all tooling and API adaptations required by those bumps.

Go / module changes
- go.mod: set `go 1.26.0`; upgrade k8s.io/* from v0.34.8 → v0.36.1,
  sigs.k8s.io/controller-runtime v0.22.5 → v0.24.1, and all transitive
  dependencies (klog, kube-openapi, prometheus, grpc, kustomize, …)

Makefile tooling
- golangci-lint: v2.11.4 → v2.12.2 (first release that fully supports Go 1.26)
- Add GO_MOD_VERSION variable and pass GOTOOLCHAIN=go$(GO_MOD_VERSION) to
  every go-install-tool invocation so tools are always built with the same
  Go version declared in go.mod, preventing the "build version lower than
  targeted version" error
- controller-gen: v0.19.0 → v0.21.0 (k8s v0.36 / Go 1.26 aligned release)
- setup-envtest: release-0.22 → release-0.24 (tracks controller-runtime v0.24)
- ENVTEST_K8S_VERSION: 1.28 → 1.36

API / webhook changes
- api/v1alpha1/groupversion_info.go: replace deprecated
  sigs.k8s.io/controller-runtime/pkg/scheme.Builder with
  k8s.io/apimachinery/pkg/runtime.NewSchemeBuilder; register all five CRD
  types centrally via addKnownTypes() and metav1.AddToGroupVersion()
- api/v1alpha1/*_types.go: remove per-file init() SchemeBuilder.Register()
  calls now that registration is centralised
- api/v1alpha1/validator/*_webhook.go: migrate from deprecated
  webhook.CustomValidator (Validator[runtime.Object]) to the typed
  admission.Validator[*ConcreteType] interface; update
  NewWebhookManagedBy(mgr, &Type{}) call (object moved from .For() to the
  constructor in controller-runtime v0.24); switch back to WithValidator()
  now that validators are properly typed; drop runtime.Object type
  assertions from each ValidateCreate/Update/Delete method

Bug fixes
- pkg/nodeinfo/filter.go: update ToleratesTaint() call to the new k8s 1.36
  signature (logger klog.Logger, taint *Taint, enableComparisonOperators bool);
  pass klog.Background() and true to preserve existing Lt/Gt operator behaviour
- scripts/sosreport/kubectl-netop_sosreport: fix two component entries whose
  keys and label selectors were left as unresolved Go template placeholders
  ({{ }}) by generate-maps.sh; correct to
  name=network-operator-sriov-device-plugin and app=rdma-shared-dp
- scripts/sosreport/kubectl-netop_sosreport: restore missing execute bit

Signed-off-by: Fred Rolland <frolland@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant