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 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

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@paulyufan2
Copy link
Contributor Author

/azp run Azure Container Networking PR

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@paulyufan2
Copy link
Contributor Author

/azp run Azure Container Networking PR

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@paulyufan2
Copy link
Contributor Author

/azp run Azure Container Networking PR

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

k8s.io/apimachinery v0.30.14
k8s.io/client-go v0.30.14
k8s.io/api v0.34.1
k8s.io/apiextensions-apiserver v0.34.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for k8s.io/apiextensions-apiserver v0.34.0 to not be k8s.io/apiextensions-apiserver v0.34.1?

Comment on lines +23 to +29
type clientWithApply struct{ *mockclients.MockClient }

// Satisfy controller-runtime v0.22.1 Writer.Apply:
func (c clientWithApply) Apply(_ context.Context, _ runtime.ApplyConfiguration, _ ...client.ApplyOption) error {
return nil // not used in these tests
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Can I get some more context here for this change?

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.

3 participants