-
-
Notifications
You must be signed in to change notification settings - Fork 324
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
Support pagination for watcher #913
Comments
Hi! While technically this shouldn't be too hard to implement into the watcher, it would break some assumptions that we make downstream. We basically have two options for implementing this:
We might also be able to do a hybrid approach, where we introduce a new |
Based on the alternatives, I'm wondering if emiting an I feel that emitting pages could allow faster consumption of items from the apiserver as they appear (at least from watcher's POV), and if backpressure works properly for us (which it might, but not sure), it could also limit how quickly the list pagination happens - lessening the load on both us and the apiserver in cases where we exit early. It is possible that we can make reflector stores do a smart internal buffering such as:
Provided we are able to learn when we receive the last page. It shouldn't use a whole lot more memory since we can just overwrite and keep a small list of things we have seen, and diff that at the end with what we didn't see (which must have been removed). |
I'm also interested on this feature, so I could try submitting a PR if we have a consensus on the design. But I'd start with the watcher only, not the reflector, as I don't have any experience with it, as well as making the scope of the PR much smaller. How does that sound? Edit: the chunked response from API server contains a |
Would you like to work on this feature?
maybe
What problem are you trying to solve?
Hi all, first thanks to
kube-rs
! It help a lot of my works on kubernetes with rust.I noticed the
Reflector
fromclient-go
uses aPager
to retrieving large results sets in chunks during listing resources: https://github.com/kubernetes/client-go/blob/0bc005e72ff13ab4ceffd5c4e0ecb1774a7bf7f8/tools/cache/reflector.go#L274-L278If it is possible to introduce pagination into
kube-rs
to reduce impact on Kubernetes API Server while fetching large results of resources?Thanks for any suggestions!
Describe the solution you'd like
The official documents of Kubernetes describe the way to retrieving large results sets in chunks.
The
Watcher
fromkube-runtime
should take list parameterlimit
on first list request and deal withcontinue_token
for later list requests, there are also some cases need to be handle, e.g. Http 410Gone
.Describe alternatives you've considered
Follow the best practice on Kubernetes Guides.
Documentation, Adoption, Migration Strategy
No response
Target crate for feature
kube-runtime
The text was updated successfully, but these errors were encountered: