resync

package
v3.0.0-pre1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package resync provides helpers for determining the effective resync period for ORC controllers, implementing the configuration resolution hierarchy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateJitteredDuration

func CalculateJitteredDuration(base time.Duration) time.Duration

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

func DetermineResyncPeriod(specValue *metav1.Duration, globalDefault time.Duration) time.Duration

DetermineResyncPeriod resolves the effective resync period using the following hierarchy:

  1. If specValue is non-nil and non-zero, return its duration (per-resource override takes precedence).
  2. If specValue is explicitly zero (0s), return 0 (resync is disabled regardless of the global default).
  3. If specValue is nil, return globalDefault.

A return value of 0 means periodic resync is disabled.

func RemainingUntilNextSync

func RemainingUntilNextSync(lastSyncTime *metav1.Time, resyncPeriod time.Duration) time.Duration

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.

Jump to

Keyboard shortcuts

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