ctrlutils

package
v1.78.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCanNotMutateNameOrNamespace = errors.New("MutateFn cannot mutate object name and/or object namespace")

Functions

func OwnerRefName added in v1.78.0

func OwnerRefName(obj client.Object, kind string) string

OwnerRefName returns the name of obj's owner reference of the given kind, or an empty string when it has none. It is how a switch to a different owner is detected.

func OwnerReference added in v1.78.0

func OwnerReference(gvk schema.GroupVersionKind, name string, uid types.UID) metav1.OwnerReference

OwnerReference builds a non-controller owner reference that blocks the owner's deletion, so an object cannot be deleted from under the dependent still using it.

func ReplaceOwnerReferences added in v1.78.0

func ReplaceOwnerReferences(obj client.Object, refs ...metav1.OwnerReference)

ReplaceOwnerReferences swaps obj's owner references of the same kinds as refs for refs themselves, leaving references of every other kind untouched. Replacing per kind is what drops the reference to an owner the object has just switched away from.

func TransformStripNode added in v1.78.0

func TransformStripNode(obj any) (any, error)

TransformStripNode is the cache transform for Nodes. The manager cache holds every node of the cluster, and most of a Node is what deckhouse-controller never reads: the managed fields, the image list, the conditions and the volume lists. They are dropped before the object is committed to the cache; the metadata, the spec and the rest of the status stay. Code that needs a dropped field reads the node from the API, not from the cache.

A field is written only when there is something to drop, which keeps the transform idempotent and free of writes for an object that comes through again (see TransformStripManagedFields in controller-runtime). Anything else, a deletion tombstone included, passes as is.

func UpdateStatusWithRetry

func UpdateStatusWithRetry(ctx context.Context, c client.Client, obj client.Object, f MutateFn, opts ...UpdateOption) error

func UpdateWithRetry

func UpdateWithRetry(ctx context.Context, c client.Client, obj client.Object, f MutateFn, opts ...UpdateOption) error

Types

type MutateFn

type MutateFn func() error

type UpdateOption

type UpdateOption func(optionsApplier UpdateOptionApplier)

func WithOnErrorBackoff

func WithOnErrorBackoff(b *wait.Backoff) UpdateOption

func WithRetryOnConflictBackoff

func WithRetryOnConflictBackoff(b *wait.Backoff) UpdateOption

func (UpdateOption) Apply

func (opt UpdateOption) Apply(o UpdateOptionApplier)

type UpdateOptionApplier

type UpdateOptionApplier interface {
	WithOnErrorBackoff(b *wait.Backoff)
	WithRetryOnConflictBackoff(b *wait.Backoff)
	// contains filtered or unexported methods
}

type UpdateOptions

type UpdateOptions struct {
	OnErrorBackoff         wait.Backoff
	RetryOnConflictBackoff wait.Backoff
	// contains filtered or unexported fields
}

func (*UpdateOptions) WithOnErrorBackoff

func (o *UpdateOptions) WithOnErrorBackoff(b *wait.Backoff)

func (*UpdateOptions) WithRetryOnConflictBackoff

func (o *UpdateOptions) WithRetryOnConflictBackoff(b *wait.Backoff)

Jump to

Keyboard shortcuts

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