spread

package
v0.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// RefreshLabel triggers an immediate reconciliation when present.
	RefreshLabel = "platform-mesh.io/refresh-reconcile"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager implements reconciliation spreading to avoid thundering-herd effects.

func NewManager

func NewManager(opts ...Option) *Manager

NewManager creates a new spread Manager with the given options. Panics if minDuration > maxDuration after applying options.

func (*Manager) ReconcileRequired

func (m *Manager) ReconcileRequired(obj client.Object) bool

ReconcileRequired returns true if the object should be reconciled now.

func (*Manager) RemoveRefreshLabel

func (m *Manager) RemoveRefreshLabel(obj client.Object) bool

RemoveRefreshLabel removes the refresh label and returns true if it was present.

func (*Manager) RequeueDelay

func (m *Manager) RequeueDelay(obj client.Object) time.Duration

RequeueDelay returns the remaining time until the next scheduled reconciliation.

func (*Manager) SetNextReconcileTime

func (m *Manager) SetNextReconcileTime(obj client.Object)

SetNextReconcileTime sets a random next reconcile time within the configured range.

func (*Manager) UpdateObservedGeneration

func (m *Manager) UpdateObservedGeneration(obj client.Object)

UpdateObservedGeneration sets the observed generation to the current generation.

type Option

type Option func(*Manager)

Option configures the spread Manager.

func WithMaxDuration

func WithMaxDuration(d time.Duration) Option

WithMaxDuration sets the maximum spread duration.

func WithMinDuration

func WithMinDuration(d time.Duration) Option

WithMinDuration sets the minimum spread duration.

type SpreadReconcileStatus

type SpreadReconcileStatus interface {
	GetObservedGeneration() int64
	SetObservedGeneration(int64)
	GetNextReconcileTime() metav1.Time
	SetNextReconcileTime(metav1.Time)
}

SpreadReconcileStatus is implemented by objects that support reconciliation spreading.

Jump to

Keyboard shortcuts

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