Skip to content

Add feature gate WatchListClient for v1.30 #47261

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

Closed
wants to merge 1 commit into from

Conversation

tengqm
Copy link
Contributor

@tengqm tengqm commented Jul 24, 2024

No description provided.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 24, 2024
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. language/en Issues or PRs related to English language labels Jul 24, 2024
Copy link

netlify bot commented Jul 24, 2024

Pull request preview available for checking

Name Link
🔨 Latest commit b047e66
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/66a47ea96ce4ab0008d0b6db
😎 Deploy Preview https://deploy-preview-47261--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@salaxander
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 25, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: c707bcb89ab6d41eacab087b43f87037c99f5cb3

@drewhagen
Copy link
Member

drewhagen commented Jul 25, 2024

/sig api-machinery scalability

cc: @p0lyn0mial @kubernetes/sig-api-machinery-misc @kubernetes/sig-scalability-pr-reviews

Can we please get some help contributing some detail to this feature gate doc? We appreciate it, thanks!

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/scalability Categorizes an issue or PR as relevant to SIG Scalability. labels Jul 25, 2024
@@ -0,0 +1,16 @@
---
title: WatchListClient
Copy link
Contributor

Choose a reason for hiding this comment

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

The WatchListClient is defined for a client (the client-go library) and not for the server.

It enables the client to request a stream of data rather than an entire list. The streamed data is then transformed into a list response on the client side.

Another way to think about this feature is that it essentially replaces standard LIST calls with WATCH calls under the hood.
Individual list items are delivered via the WATCH call and transformed into a list response on the client.
This process is completely opaque to the client requesting a list.
For the client, it doesn’t matter whether the library issues a LIST or WATCH request/verb.
The client only cares about the result, which will be a list response.

Also, for the WatchListClient to work, the server must support API Streaming, which is controlled by a server-side WatchList feature flag. If the server doesn't support the API Streaming and the WatchListClient is enabled then the client falls back/issues to a standard LIST request.

Copy link
Contributor

@sftim sftim Jul 26, 2024

Choose a reason for hiding this comment

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

Will this feature gate be configurable on API clients such as: the kubelet, kube-controller-manager, the scheduler?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The WatchListClient is defined for a client (the client-go library) and not for the server.

So if I'm interacting with a Kubernetes cluster using pure RESTful API, and I'm developing
a client tool in Python or Rust, this feature gate doesn't matter at all. But ...
it is listed in the command line options for kube-apiserver, kube-controller-manager, kube-scheduler, kube-proxy and kubelet. Right?

Copy link
Contributor

Choose a reason for hiding this comment

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

I assume you can configure some of those components to enable or not enable this feature when acting as a client of the API server.

Copy link
Contributor

Choose a reason for hiding this comment

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

sftim 2 minutes ago
Well this feature gate be configurable on API clients such as: the kubelet, kube-controller-manager, the scheduler?

yes, kubernetes will expose the WatchListClient feature gate via command line options for some/all control plane components. Initially we were planning to enable the WatchListClient by default only for KCM.

Copy link
Contributor

Choose a reason for hiding this comment

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

So if I'm interacting with a Kubernetes cluster using pure RESTful API, and I'm developing
a client tool in Python or Rust, this feature gate doesn't matter at all

yes, that is correct, in that case, the WatchList feature gate on the server-side matters.

Comment on lines 13 to 16
Enable the API server to serve collections (responses to the **list** verb)
from its watch cache, rather than always from the back store etcd.
When this feature gate is disabled, the API server falls back to its legacy behavior
where data are fetched from etcd instead of served from the watch cache.
Copy link
Contributor

Choose a reason for hiding this comment

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

@tengqm tengqm marked this pull request as draft July 26, 2024 11:17
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 26, 2024
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 27, 2024
@k8s-ci-robot k8s-ci-robot requested a review from salaxander July 27, 2024 04:59
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from salaxander. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tengqm tengqm marked this pull request as ready for review July 27, 2024 04:59
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 27, 2024
Comment on lines +13 to +15
This enables an API client (inlcuding some control plane components) to
request a stream of data rather than an entire list. The behavior change
is implemented in the client-go library and it is opaque to the client.
Copy link
Contributor

@sftim sftim Jul 27, 2024

Choose a reason for hiding this comment

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

Typo in “inlcuding“.

Revised suggestion:

Suggested change
This enables an API client (inlcuding some control plane components) to
request a stream of data rather than an entire list. The behavior change
is implemented in the client-go library and it is opaque to the client.
Enable selected control plane components to fetch collections using **watch** rather
than **list** requests, as an optimization.
If you enable this feature gate, you should also check that any custom authorization rules allow
kube-controller-manager and its service identities to perform **watch** requests, otherwise
you will not benefit from the improvement.
If you do not use custom authorization rules, you only need to enable the feature gate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Em ... why we want to touch the authorization topic in this feature gate?

Copy link
Contributor

@sftim sftim Jul 28, 2024

Choose a reason for hiding this comment

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

I checked and actually the control plane should be able to fall back to list, so no authz changes are needed. I edited the suggestion.

@p0lyn0mial
Copy link
Contributor

Are there any plans to resume work on this PR?

@tengqm
Copy link
Contributor Author

tengqm commented Sep 12, 2024

Are there any plans to resume work on this PR?

I have no idea how to proceed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/scalability Categorizes an issue or PR as relevant to SIG Scalability. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants