ratelimiter

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: Apache-2.0 Imports: 8 Imported by: 13

Documentation

Overview

Package ratelimiter contains suggested default ratelimiters for providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LimitRESTConfig

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

func NewController() workqueue.TypedRateLimiter[any]

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

func NewGlobal(rps int) *workqueue.TypedBucketRateLimiter[any]

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.

func NewGlobalExponential

func NewGlobalExponential(baseDelay time.Duration, maxDelay time.Duration) workqueue.TypedRateLimiter[any]

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 New

New 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

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