Skip to content

Conversation

@paulyufan2
Copy link
Contributor

@paulyufan2 paulyufan2 commented Sep 15, 2025

Reason for Change:

  1. Change 1: Healthz:
    Since sigs.k8s.io/controller-runtime v0.18.x, the default RESTMapper is discovery-based. Because the NewHealthzHandlerWithChecks() builds a client with only Scheme: cli, err := client.New(cfg, client.Options{ Scheme: scheme })
    controller-runtime now hits the API discovery endpoints to map GVK→GVR before doing cli.List(...).
    Our mock API server from configureLocalAPIServer() doesn’t implement discovery (and likely doesn’t return a decodable body for the list), so mapping/decoding fails → health check returns error → test expects healthy (200) but gets unhealthy.

2.Change 2: k8s.io/kubernetes/pkg/kubelet
To solve this issue after we upgrade k8s packages:
go: github.com/Azure/azure-container-networking/cns/middlewares imports
k8s.io/kubernetes/pkg/kubelet imports
k8s.io/cri-client/pkg: reading k8s.io/cri-client/go.mod at revision v0.0.0: unknown revision v0.0.0
go: github.com/Azure/azure-container-networking/cns/middlewares imports
k8s.io/kubernetes/pkg/kubelet imports
k8s.io/kubernetes/pkg/kubelet/apis/podresources imports
k8s.io/cri-client/pkg/util: reading k8s.io/cri-client/go.mod at revision v0.0.0: unknown revision v0.0.0

This error is the reason why we shouldn’t import k8s.io/kubernetes/pkg/kubelet. The k8s.io/kubernetes monorepo has local replace rules for its staging deps (like k8s.io/cri-client) that don’t work outside the tree, so Go tries to resolve a fake v0.0.0 and fails. Instead we should using the staged modules to fix this.
kubelet.NetworkNotReadyErrorMsg == NetworkNotReadyErrorMsg = "network is not ready"
so make this as a constant variable makes more sense

Issue Fixed:

This PR is to update k8s.io dependencies along with dependencies changes

Requirements:

Notes:

@paulyufan2 paulyufan2 requested review from a team as code owners September 15, 2025 20:03
@paulyufan2 paulyufan2 added the dependencies Dependencies only. label Sep 15, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates k8s.io dependencies to newer versions and removes the dependency on k8s.io/kubernetes/pkg/kubelet. As part of this change, the NetworkNotReadyErrorMsg constant is defined locally in the codebase rather than importing it from the kubelet package.

  • Updated k8s.io dependencies to v0.34.1 and removed k8s.io/kubernetes dependency
  • Defined NetworkNotReadyErrorMsg constant locally in affected modules
  • Updated various indirect dependencies to compatible versions

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
go.mod Updated k8s.io dependencies to v0.34.1 and removed k8s.io/kubernetes, updated various indirect dependencies
network/secondary_endpoint_client_linux.go Added local NetworkNotReadyErrorMsg constant and updated error usage
network/secondary_endpoint_linux_test.go Removed kubelet import and updated error message reference
cns/middlewares/k8sSwiftV2.go Added local NetworkNotReadyErrorMsg constant but kept old kubelet references in error variables
cns/middlewares/k8sSwiftV2_linux_test.go Removed kubelet import and updated test assertions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@paulyufan2
Copy link
Contributor Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@paulyufan2
Copy link
Contributor Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@paulyufan2
Copy link
Contributor Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@paulyufan2
Copy link
Contributor Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

rbtr
rbtr previously approved these changes Oct 2, 2025
@paulyufan2
Copy link
Contributor Author

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pjohnst5
Copy link
Contributor

pjohnst5 commented Oct 2, 2025

Hi @rbtr , what version of k8s is this meant for?

@rbtr
Copy link
Collaborator

rbtr commented Oct 2, 2025

@pjohnst5 the main branch is currently the 1.7.x release train and deploys to AKS from 1.33-1.35

@paulyufan2 paulyufan2 added this pull request to the merge queue Oct 2, 2025
@pjohnst5
Copy link
Contributor

pjohnst5 commented Oct 2, 2025

Okay thanks @rbtr , I will be looking into if without these, k8s v1.34 would break for example, unless you know that already (were these necessary for 1.34-5? Or just good hygiene?)

Merged via the queue into master with commit a864d49 Oct 2, 2025
12 of 13 checks passed
@paulyufan2 paulyufan2 deleted the updateK8sIODependencies branch October 2, 2025 21:51
sivakami-projects pushed a commit that referenced this pull request Oct 23, 2025
* Chore: update k8s.io dependencies

* Update cns/middlewares/k8sSwiftV2.go

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Paul Yu <[email protected]>

* controller-runtime needs to be updated

* fix controller-runtime v0.22.1 Apply method missing

* fix UT

* fix linter issues

* fix linter issue

* fix healthz issues

* fix linter issues

* add new error var

* upgrade apiserver to v0.34.1

---------

Signed-off-by: Paul Yu <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Dependencies only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants