utils

package
v0.0.0-...-25066aa Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorOp  = "error"
	UpdateOp = "updated"
	NoOp     = "unchanged"
	CreateOp = "created"
)

Variables

View Source
var DefaultRequeueDuration = (time.Minute * 5)

Used for Jitter in requeueing

Functions

func Jitter

func Jitter(t time.Duration, maxJitterPercent int) (time.Duration, error)

Jitter accepts a Duration and maximum percentage to jitter (as an int), and returns a random Duration in the range t +/- maxJitterPercent.

func JitterRequeue

func JitterRequeue(defaultDuration time.Duration, maxJitterPercent int, log logr.Logger) reconcile.Result

JitterRequeue accepts a default requeue time, a maximum percentage to jitter, and a logger, and returns a Result containing a requeue time which has been randomized with jitter.

Types

type ClientHelper

type ClientHelper struct {
	client.Client
}

func (*ClientHelper) CreateOrUpdate

func (r *ClientHelper) CreateOrUpdate(ctx context.Context, obj client.Object) (string, error)

CreateOrUpdate attempts first to patch the object given but if an IsNotFound error is returned it instead creates the resource.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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