Documentation ¶
Overview ¶
Package ratelimiter contains suggested default ratelimiters for Crossplane.
Index ¶
- Constants
- func LimitRESTConfig(cfg *rest.Config, rps int) *rest.Config
- func NewController() ratelimiter.RateLimiter
- func NewDefaultManagedRateLimiter(provider ratelimiter.RateLimiter) ratelimiter.RateLimiterdeprecated
- func NewDefaultProviderRateLimiter(rps int) *workqueue.BucketRateLimiterdeprecated
- func NewGlobal(rps int) *workqueue.BucketRateLimiter
- type Reconciler
Constants ¶
const ( // DefaultProviderRPS is the recommended default average requeues per // second tolerated by a Crossplane provider. // // Deprecated: Use a flag DefaultProviderRPS = 1 )
Variables ¶
This section is empty.
Functions ¶
func LimitRESTConfig ¶
LimitRESTConfig returns a copy of the supplied REST config with rate limits derived from the supplied rate of reconciles per second.
func NewController ¶
func NewController() ratelimiter.RateLimiter
NewController returns a rate limiter that takes the maximum delay between the passed rate limiter and a per-item exponential backoff limiter. The exponential backoff limiter has a base delay of 1s and a maximum of 60s.
func NewDefaultManagedRateLimiter
deprecated
func NewDefaultManagedRateLimiter(provider ratelimiter.RateLimiter) ratelimiter.RateLimiter
NewDefaultManagedRateLimiter returns a rate limiter that takes the maximum delay between the passed provider and a per-item exponential backoff limiter. The exponential backoff limiter has a base delay of 1s and a maximum of 60s.
Deprecated: Use NewController.
func NewDefaultProviderRateLimiter
deprecated
func NewDefaultProviderRateLimiter(rps int) *workqueue.BucketRateLimiter
NewDefaultProviderRateLimiter returns a token bucket rate limiter meant for limiting the number of average total requeues per second for all controllers registered with a controller manager. The bucket size is a linear function of the requeues per second.
Deprecated: Use NewGlobal.
func NewGlobal ¶
func NewGlobal(rps int) *workqueue.BucketRateLimiter
NewGlobal returns a token bucket rate limiter meant for limiting the number of average total requeues per second for all controllers registered with a controller manager. The bucket size (i.e. allowed burst) is rps * 10.
Types ¶
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
A Reconciler rate limits an inner, wrapped Reconciler. Requests that are rate limited immediately return RequeueAfter: d without calling the wrapped Reconciler, where d is imposed by the rate limiter.
func NewReconciler ¶
func NewReconciler(name string, r reconcile.Reconciler, l ratelimiter.RateLimiter) *Reconciler
NewReconciler wraps the supplied Reconciler, ensuring requests are passed to it no more frequently than the supplied RateLimiter allows. Multiple uniquely named Reconcilers can share the same RateLimiter.