utils

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LifecycleEnabledPredicate = predicate.NewPredicateFuncs(func(object client.Object) bool {
		if hv, ok := object.(*kvmv1.Hypervisor); ok {
			return hv.Spec.LifecycleEnabled
		}
		return true
	})
)
View Source
var StatusPatchBackoff = wait.Backoff{
	Steps:    10,
	Duration: 50 * time.Millisecond,
	Factor:   2.0,
	Jitter:   0.2,
}

StatusPatchBackoff is a retry backoff for status patches that may conflict with other controllers. Uses exponential backoff with more retries than the default to handle high contention scenarios.

Functions

func Difference added in v1.2.1

func Difference[S ~[]E, E comparable](s1, s2 S) S

Difference returns all elements in s2 that are not in s1.

func PatchHypervisorStatusWithRetry added in v1.1.0

func PatchHypervisorStatusWithRetry(ctx context.Context, c k8sclient.Client, name, fieldOwner string, updateFn func(*kvmv1.Hypervisor)) error

PatchHypervisorStatusWithRetry patches hypervisor status with retry on conflict. The updateFn receives a fresh copy of the hypervisor and should apply status changes to it. It re-fetches the resource before each retry attempt to get the latest resourceVersion.

Types

This section is empty.

Jump to

Keyboard shortcuts

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