controllerutils

package
v0.22.12 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 9 Imported by: 47

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ObjectMetasEqual

func ObjectMetasEqual(obj1, obj2 metav1.Object) bool

returns true if "relevant" parts of obj1 and obj2 have equal: -labels -annotations -namespace+name or if the objects are not metav1.Objects

func ObjectStatusesEqual

func ObjectStatusesEqual(obj1, obj2 runtime.Object) bool

returns true if the Status of obj1 and obj2 are equal. The objects should have a field named Status or this function will panic.

func ObjectsEqual

func ObjectsEqual(obj1, obj2 runtime.Object) bool

returns true if "relevant" parts of obj1 and obj2 have equal: - labels, - annotations, - namespace+name, - non-metadata, non-status fields Note that Status fields are not compared. To compare status fields, use ObjectStatusesEqual

func UpdateStatus

Easily Update the Status of a desired object in the cluster. Requires that the object already exists (will only attempt to update).

If the desired object status is semantically equal to the existing object status, the update is skipped.

func UpdateStatusImmutable added in v0.7.17

func UpdateStatusImmutable(
	ctx context.Context,
	c client.Client,
	obj client.Object,
) (controllerutil.OperationResult, error)

Easily Update the Status of a desired object in the cluster. Requires that the object already exists (will only attempt to update).

If the desired object status is semantically equal to the existing object status, the update is skipped. Unlike the method above, this method does not update obj.

func Upsert

func Upsert(
	ctx context.Context,
	c client.Client,
	obj client.Object,
	transitionFuncs ...TransitionFunc,
) (controllerutil.OperationResult, error)

Upsert a desired object to the cluster.

If the object exists, the provided TransitionFuncs will be called. Resource version for the desired object will be set automatically.

If the desired object (after applying transition funcs) is semantically equal to the existing object, the update is skipped.

func UpsertImmutable added in v0.22.6

func UpsertImmutable(
	ctx context.Context,
	c client.Client,
	obj client.Object,
	transitionFuncs ...TransitionFunc,
) (controllerutil.OperationResult, error)

UpsertImmutable functions similarly to it's Upsert counterpart, but it will copy obj before saving it.

Types

type TransitionFunc

type TransitionFunc func(existing, desired runtime.Object) error

TransitionFunc performs a comparison of the the existing object with the desired object before a desired object is Upserted to kube storage.

Jump to

Keyboard shortcuts

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