patch

package
v2.4.0-rapid.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 13 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

This section is empty.

Functions

func ApplyPatchIfNotEmpty

func ApplyPatchIfNotEmpty[
	T client.Object,
](
	ctx context.Context,
	cl client.Client,
	logger logr.Logger,
	existingResource T,
	oldExistingResource T,
	updated bool,
) (res op.Result, deploy T, err error)

ApplyPatchIfNotEmpty patches the provided resource if the resulting patch between the provided existingResource and the provided oldExistingResource is non empty.

func ApplyStatusPatchIfNotEmpty

func ApplyStatusPatchIfNotEmpty[
	T client.Object,
](
	ctx context.Context,
	cl client.Client,
	logger logr.Logger,
	existing T,
	oldExisting T,
) (res op.Result, err error)

ApplyStatusPatchIfNotEmpty patches the provided object if the resulting patch between the provided existing and oldExisting is non empty.

func SetStatusWithConditionIfDifferent

func SetStatusWithConditionIfDifferent[T interface {
	client.Object
	k8sutils.ConditionsAware
}](
	ent T,
	conditionType kcfgconsts.ConditionType,
	conditionStatus metav1.ConditionStatus,
	conditionReason kcfgconsts.ConditionReason,
	conditionMessage string,
) bool

SetStatusWithConditionIfDifferent sets the status of the provided object with the given condition if the condition is different from the current one. It does not take LastTransitionTime into account. The return value tells whether status needs an update.

func StatusWithCondition

func StatusWithCondition[T interface {
	client.Object
	k8sutils.ConditionsAware
}](
	ctx context.Context,
	cl client.Client,
	ent T,
	conditionType kcfgconsts.ConditionType,
	conditionStatus metav1.ConditionStatus,
	conditionReason kcfgconsts.ConditionReason,
	conditionMessage string,
) (ctrl.Result, error)

StatusWithCondition patches the status of the provided object with the given condition. If the condition is already set and it's as expected, it returns without patching.

func StatusWithConditions

func StatusWithConditions[T interface {
	client.Object
	k8sutils.ConditionsAware
}](
	ctx context.Context,
	cl client.Client,
	ent T,
	conditions ...metav1.Condition,
) (res ctrl.Result, updated bool, err error)

StatusWithConditions patches the status of the provided object with the given conditions.

func StatusWithoutCondition added in v2.1.1

func StatusWithoutCondition[T interface {
	client.Object
	k8sutils.ConditionsAware
}](
	ctx context.Context,
	cl client.Client,
	ent T,
	conditionType string,
) (res ctrl.Result, err error)

StatusWithoutCondition patches the status of the provided object without the given condition. If the condition is not set, it returns without patching.

func WithFinalizer

func WithFinalizer[
	T client.Object,
](
	ctx context.Context,
	cl client.Client,
	ent T,
	finalizer string,
) (bool, ctrl.Result, error)

WithFinalizer patches the provided object with the provided finalizer. It returns a ctrl.Result, a bool, and an error.

func WithoutFinalizer added in v2.1.1

func WithoutFinalizer[
	T client.Object,
](
	ctx context.Context,
	cl client.Client,
	ent T,
	finalizer string,
) (bool, ctrl.Result, error)

WithoutFinalizer patches the provided object to remove the provided finalizer. It returns a bool indicating whether the finalizer was removed, a ctrl.Result, and an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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