Documentation
¶
Index ¶
- Variables
- func ConditionFromStatus(c metav1.Condition) *k8sacmetav1.ConditionApplyConfiguration
- func Difference[S ~[]E, E comparable](s1, s2 S) S
- func PatchHypervisorStatusWithRetry(ctx context.Context, c k8sclient.Client, name, fieldOwner string, ...) error
- func SetApplyConfigurationStatusCondition(conditions *[]k8sacmetav1.ConditionApplyConfiguration, ...)
Constants ¶
This section is empty.
Variables ¶
var ( LifecycleEnabledPredicate = predicate.NewPredicateFuncs(func(object client.Object) bool { if hv, ok := object.(*kvmv1.Hypervisor); ok { return hv.Spec.LifecycleEnabled } return true }) )
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 ConditionFromStatus ¶ added in v1.3.0
func ConditionFromStatus(c metav1.Condition) *k8sacmetav1.ConditionApplyConfiguration
ConditionFromStatus converts a single metav1.Condition into a *k8sacmetav1.ConditionApplyConfiguration, preserving all fields verbatim (including LastTransitionTime and ObservedGeneration).
Controllers must seed their apply-config payload with the conditions they own before mutating them. With +listType=map / +listMapKey=type on the CRD, SSA merges conditions by the "type" key: conditions owned by other field managers are left untouched, and conditions previously written by this field manager that are absent from the payload are pruned. Therefore each controller should include all conditions it has previously set — and only those — in every Apply call.
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.
func SetApplyConfigurationStatusCondition ¶ added in v1.3.0
func SetApplyConfigurationStatusCondition(conditions *[]k8sacmetav1.ConditionApplyConfiguration, newCondition k8sacmetav1.ConditionApplyConfiguration)
SetApplyConfigurationStatusCondition sets the corresponding condition in conditions to newCondition. It mirrors the behaviour of k8s.io/apimachinery/pkg/api/meta.SetStatusCondition:
- If a condition of the specified type does not exist, newCondition is appended. LastTransitionTime is set to now if not provided.
- If a condition of the specified type already exists, all fields are updated. LastTransitionTime is updated to now (or the provided value) only when Status changes; otherwise the existing LastTransitionTime is preserved.
Types ¶
This section is empty.