Documentation
¶
Overview ¶
Package resync provides helpers for determining the effective resync period for ORC controllers, implementing the configuration resolution hierarchy.
Index ¶
- func CalculateJitteredDuration(base time.Duration) time.Duration
- func DetermineResyncPeriod(specValue *metav1.Duration, globalDefault time.Duration) time.Duration
- func RemainingUntilNextSync(lastSyncTime *metav1.Time, resyncPeriod time.Duration) time.Duration
- func ShouldScheduleResync(resyncPeriod time.Duration, reconcileStatus progress.ReconcileStatus) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateJitteredDuration ¶
CalculateJitteredDuration returns a duration in the range [base, base*1.2) using uniform random positive-only jitter. Jitter prevents thundering-herd problems when many resources share the same resync period.
func DetermineResyncPeriod ¶
DetermineResyncPeriod resolves the effective resync period using the following hierarchy:
- If specValue is non-nil and non-zero, return its duration (per-resource override takes precedence).
- If specValue is explicitly zero (0s), return 0 (resync is disabled regardless of the global default).
- If specValue is nil, return globalDefault.
A return value of 0 means periodic resync is disabled.
func RemainingUntilNextSync ¶
RemainingUntilNextSync returns how long remains before the next periodic resync is due. It returns 0 when periodic resync is disabled, lastSyncTime is unset, or the period has already elapsed.
func ShouldScheduleResync ¶
func ShouldScheduleResync(resyncPeriod time.Duration, reconcileStatus progress.ReconcileStatus) bool
ShouldScheduleResync reports whether a periodic resync should be scheduled based on the effective resync period and the current reconcile status.
It returns false (do not schedule) when:
- resyncPeriod <= 0: periodic resync is disabled.
- reconcileStatus contains a terminal error: the resource is in a non-retryable error state; resync would be pointless.
- reconcileStatus already requests a requeue: another reconcile is already pending so a resync requeue would be redundant.
When it returns true, the caller should schedule a requeue after CalculateJitteredDuration(resyncPeriod).
Types ¶
This section is empty.