Stop watching v1 Endpoints when EndpointSlices are enabled - #15566
Open
pujitha24 wants to merge 1 commit into
Open
Stop watching v1 Endpoints when EndpointSlices are enabled#15566pujitha24 wants to merge 1 commit into
pujitha24 wants to merge 1 commit into
Conversation
Problem The destination controller always started a v1 Endpoints informer (controller/cmd/destination/main.go), even when --enable-endpoint-slices is true (the default). Every consumer of that informer in the watcher package (endpoints_watcher.go, workload_watcher.go, service_publisher.go, port_publisher.go) already branches on enableEndpointSlices and only reads from it when EndpointSlices are disabled, so with the default configuration the informer's LIST/WATCH calls to the v1 Endpoints API served no purpose. On clusters that flag v1 Endpoints as deprecated (e.g. EKS 1.34+), those unused calls flood linkerd-destination's logs with: level=info msg="Warning: v1 Endpoints is deprecated in v1.33+; use discovery.k8s.io/v1 EndpointSlice" This is log noise only; destination service behavior is unchanged before and after this fix, since the v1 Endpoints informer was never actually read from in this mode. Solution Only request the k8s.Endpoint informer resource when --enable-endpoint-slices is false, mirroring the conditional resource selection already used for the destination controller's remote-cluster watchers in controller/api/destination/watcher/cluster_store.go. Validation Ran, all passing: go build ./controller/... go test -race ./controller/cmd/destination/... ./controller/api/destination/... ./controller/k8s/... This confirms the build and existing behavioral tests (including coverage of the enableEndpointSlices-gated code paths) are unaffected by no longer constructing the v1 Endpoints informer. This was not reproduced against a live cluster exhibiting the deprecation warning; the fix follows directly from removing the only remaining unconditional consumer of the v1 Endpoints API in this code path, which is what triggers the apiserver's deprecation warning on List/Watch. Report: linkerd#15561 Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Contributor
Author
|
Just checking in on this one — it's still rebased and green (DCO passing, no merge conflicts); happy to make any changes if something would make it easier to review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stop watching v1 Endpoints when EndpointSlices are enabled
Problem
The destination controller always started a v1 Endpoints informer (controller/cmd/destination/main.go), even when --enable-endpoint-slices is true (the default). Every consumer of that informer in the watcher package (endpoints_watcher.go, workload_watcher.go, service_publisher.go, port_publisher.go) already branches on enableEndpointSlices and only reads from it when EndpointSlices are disabled, so with the default configuration the informer's LIST/WATCH calls to the v1 Endpoints API served no purpose. On clusters that flag v1 Endpoints as deprecated (e.g. EKS 1.34+), those unused calls flood linkerd-destination's logs with:
This is log noise only; destination service behavior is unchanged before and after this fix, since the v1 Endpoints informer was never actually read from in this mode.
Solution
Only request the k8s.Endpoint informer resource when --enable-endpoint-slices is false, mirroring the conditional resource selection already used for the destination controller's remote-cluster watchers in controller/api/destination/watcher/cluster_store.go.
Validation
Ran, all passing:
This confirms the build and existing behavioral tests (including coverage of the enableEndpointSlices-gated code paths) are unaffected by no longer constructing the v1 Endpoints informer. This was not reproduced against a live cluster exhibiting the deprecation warning; the fix follows directly from removing the only remaining unconditional consumer of the v1 Endpoints API in this code path, which is what triggers the apiserver's deprecation warning on List/Watch.
Fixes #15561
Signed-off-by: Pujitha Paladugu 10557236+pujitha24@users.noreply.github.com
AI assistance: this change was drafted with Claude Code.