-
-
Notifications
You must be signed in to change notification settings - Fork 325
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
Rate Limiting Strategies #500
Comments
I think kube should somehow reuse existing rate limit implementations from the Tower ecosystem. In that case, this issue looks like "ability to inject arbitrary Services on client or Api level". |
Custom client with layers is now supported. You can do this for global: use kube::{client::ConfigExt, Client, Config};
use tower::{limit::RateLimitLayer, ServiceBuilder};
let config = Config::infer().await?;
let https = config.native_tls_https_connector()?;
let client = Client::new(
ServiceBuilder::new()
.layer(config.base_uri_layer())
.layer(RateLimitLayer::new(num, duration))
.service(hyper::Client::builder().build(https))
); |
Awesome, thanks! |
Summary of status after going through issues a bit.
For 2; It would be nice to have some examples showcasing individual method retries here. Also plays into #34 Not sure we should do more on the last one here. It would be complicated. This could be improved in the But for now going to limit the scope of this ticket to just get examples that show how to do this:
|
using custom-client-trace example - for #500 Signed-off-by: clux <[email protected]>
* showcase rate limiting strategies in example using custom-client-trace example - for #500 Signed-off-by: clux <[email protected]> * fmt Signed-off-by: clux <[email protected]>
The official Go client provides rate limiters to prevent spamming the API with requests.
See https://pkg.go.dev/k8s.io/[email protected]/util/workqueue
It would be nice to get similar functionality in this project.
Useful would be:
Api<T>
specific rate limiterThe text was updated successfully, but these errors were encountered: