-
Notifications
You must be signed in to change notification settings - Fork 256
Chore: update k8s.io dependencies #4042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
/azp run Azure Container Networking PR |
Azure Pipelines successfully started running 1 pipeline(s). |
Co-authored-by: Copilot <[email protected]> Signed-off-by: Paul Yu <[email protected]>
…ure-container-networking into updateK8sIODependencies
/azp run Azure Container Networking PR |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run Azure Container Networking PR |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run Azure Container Networking PR |
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 |
There was a problem hiding this comment.
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
?
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 | ||
} | ||
|
There was a problem hiding this comment.
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?
Reason for Change:
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: