mutate

package
v1.17.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Retriable

func Retriable(err error) bool

Retriable identifies Kubernetes apiserver errors that are normally transient and safely retriable.

func RetriableOrConflict

func RetriableOrConflict(err error) bool

RetriableOrConflict identifies Kubernetes apiserver errors that are either retriable or a conflict (retriable with GET + mutation).

func Spec added in v1.17.0

func Spec(ctx context.Context, c client.Client, obj client.Object, mutateFn Func) (bool, error)

Spec attempts to update an object until successful or update becomes unnecessary (`NoUpdateError` from the `mutate.Func`). Retries are quick, with no backoff. Returns an error if the status update fails OR if the mutate func fails.

func Status

func Status(ctx context.Context, c client.Client, obj client.Object, mutateFn Func) (bool, error)

Status attempts to update the status of an object until successful or update becomes unnecessary (`NoUpdateError` from the `mutate.Func`). Retries are quick, with no backoff. Returns an error if the status update fails OR if the mutate func fails OR if the generation changes before the status update succeeds.

Types

type Func

type Func func() error

Func is a function which mutates an existing object into its desired state.

type NoUpdateError

type NoUpdateError struct{}

NoUpdateError tells the caller that no update is required. Use with `WithRetry` and `Status` by returning a NoUpdateError from the `mutate.Func`.

func (*NoUpdateError) Error

func (nue *NoUpdateError) Error() string

Error returns the error message string

Jump to

Keyboard shortcuts

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