ratelimiter

package
v1.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 797

Documentation

Overview

Package ratelimiter contains suggested default ratelimiters for Crossplane.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LimitRESTConfig added in v0.16.0

func LimitRESTConfig(cfg *rest.Config, rps int) *rest.Config

LimitRESTConfig returns a copy of the supplied REST config with rate limits derived from the supplied rate of reconciles per second.

func NewController added in v0.16.0

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 NewGlobal added in v0.16.0

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 added in v0.16.0

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 added in v0.16.0

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.

func (*Reconciler) Reconcile added in v0.16.0

func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)

Reconcile the supplied request subject to rate limiting.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL