Skip to content

Update slightly obsolete / deprecated client library references in KNE - #750

Open
kraney wants to merge 2 commits into
openconfig:mainfrom
kraney:k8s-v23
Open

Update slightly obsolete / deprecated client library references in KNE#750
kraney wants to merge 2 commits into
openconfig:mainfrom
kraney:k8s-v23

Conversation

@kraney

@kraney kraney commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

remove direct controller-runtime dependency and modernize CRD clients

Refactor Nokia node implementation and Metallb / Meshnet clientsets to use
standard client-go dynamic clients and static TypeMeta definitions, completely
eliminating sigs.k8s.io/controller-runtime as a direct dependency.

Summary of changes:
- topo/node/nokia/nokia.go:
  - Replace controller-runtime Client (ctrlclient.New, c.Create, c.Delete)
    with dynamic.NewForConfig and c.Resource(srlGVR).Namespace(ns).Create/Delete.
  - Convert srlinuxv1.Srlinux resources to unstructured.Unstructured via
    runtime.DefaultUnstructuredConverter, consistent with other KNE nodes.
  - Remove newSrlinuxClientWithSchema and controller-runtime imports.
- api/metallb/clientset/v1beta1:
  - In ipaddresspool.go and l2advertisement.go, assign TypeMeta statically
    (Kind and metallbv1.GroupVersion) instead of calling apiutil.GVKForObject.
  - In client.go, remove metallbv1.AddToScheme(Scheme) from init() to avoid
    package initialization side-effects.
  - Remove unused controller-runtime/pkg/client/apiutil imports.
- third_party/meshnet/api/clientset/v1beta1/topology.go:
  - Assign TypeMeta statically (Kind: "Topology", topologyv1.SchemeGroupVersion)
    instead of calling apiutil.GVKForObject.
  - Remove unused apiutil import.
- go.mod & go.sum:
  - Remove sigs.k8s.io/controller-runtime as a direct dependency.
  
Also:
Update K8s nodeaffinity references

These are no longer in beta (for some time) use the official reference

Rationale:
- Simplifies KNE dependency tree by relying exclusively on client-go and
  apimachinery rather than pulling in the full controller-runtime framework.
- Standardizes CRD creation and deletion across all node implementations.
- Avoids runtime reflection and scheme registration errors during clientset
  initialization.

Note for googlers - see b/540005636 and cl/968544355

kraney added 2 commits August 20, 2026 19:50
These are no longer in beta (for some time) use the official reference
…ients

Refactor Nokia node implementation and Metallb / Meshnet clientsets to use
standard client-go dynamic clients and static TypeMeta definitions, completely
eliminating sigs.k8s.io/controller-runtime as a direct dependency.

Summary of changes:
- topo/node/nokia/nokia.go:
  - Replace controller-runtime Client (ctrlclient.New, c.Create, c.Delete)
    with dynamic.NewForConfig and c.Resource(srlGVR).Namespace(ns).Create/Delete.
  - Convert srlinuxv1.Srlinux resources to unstructured.Unstructured via
    runtime.DefaultUnstructuredConverter, consistent with other KNE nodes.
  - Remove newSrlinuxClientWithSchema and controller-runtime imports.
- api/metallb/clientset/v1beta1:
  - In ipaddresspool.go and l2advertisement.go, assign TypeMeta statically
    (Kind and metallbv1.GroupVersion) instead of calling apiutil.GVKForObject.
  - In client.go, remove metallbv1.AddToScheme(Scheme) from init() to avoid
    package initialization side-effects.
  - Remove unused controller-runtime/pkg/client/apiutil imports.
- third_party/meshnet/api/clientset/v1beta1/topology.go:
  - Assign TypeMeta statically (Kind: "Topology", topologyv1.SchemeGroupVersion)
    instead of calling apiutil.GVKForObject.
  - Remove unused apiutil import.
- go.mod & go.sum:
  - Remove sigs.k8s.io/controller-runtime as a direct dependency.

Rationale:
- Simplifies KNE dependency tree by relying exclusively on client-go and
  apimachinery rather than pulling in the full controller-runtime framework.
- Standardizes CRD creation and deletion across all node implementations.
- Avoids runtime reflection and scheme registration errors during clientset
  initialization.

Note for googlers - see b/540005636 and cl/968544355
@kraney kraney changed the title K8s v23 Update slightly obsolete / deprecated client library references in KNE Aug 21, 2026
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