staging

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConditionTypeReady      = "Ready"
	ConditionTypePlanning   = "Planning"
	ConditionTypeValidation = "Validation"
	ConditionTypeExecution  = "Execution"

	ReasonInProgress = "InProgress"
	ReasonSucceeded  = "Succeeded"
	ReasonFailed     = "Failed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	ID               BatchID
	Resources        []rules.WSAResource
	StartTime        time.Time
	Plan             *ReconciliationPlan
	ValidationResult *ValidationResult
	LastError        error
	RequeueAfter     time.Duration
}

func NewBatch

func NewBatch(events []*EventInfo) *Batch

type BatchID

type BatchID uuid.UUID

func NewBatchID

func NewBatchID() BatchID

func (BatchID) String

func (id BatchID) String() string

type BatchQueue

type BatchQueue interface {
	Add(batch *Batch)
	AddRateLimited(batch *Batch)
	Get() (*Batch, bool)
	Done(batch *Batch)
	Forget(batch *Batch)
	NumRequeues(batch *Batch) int
	ShutDown()
}

func NewBatchQueue

func NewBatchQueue() BatchQueue

type Debouncer

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

func NewDebouncer

func NewDebouncer(timeout time.Duration, callback func()) *Debouncer

func (*Debouncer) Debounce

func (m *Debouncer) Debounce()

func (*Debouncer) Start

func (m *Debouncer) Start(ctx context.Context)

type EventCollector

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

func NewEventCollector

func NewEventCollector(debounceInterval time.Duration, maxBatchSize int) *EventCollector

func (*EventCollector) AddEvent

func (ec *EventCollector) AddEvent(event *EventInfo)

func (*EventCollector) BatchChannel

func (ec *EventCollector) BatchChannel() <-chan []*EventInfo

func (*EventCollector) FlushEvents

func (ec *EventCollector) FlushEvents()

FlushEvents forces any pending events to be sent as a batch immediately.

func (*EventCollector) Start

func (ec *EventCollector) Start(ctx context.Context) error

type EventInfo

type EventInfo struct {
	Resource        rules.WSAResource
	EventType       EventType
	Generation      int64
	ResourceVersion string
	Timestamp       time.Time
}

type EventType

type EventType string
const (
	EventTypeCreate EventType = "Create"
	EventTypeUpdate EventType = "Update"
	EventTypeDelete EventType = "Delete"
)

type ReconciliationPlan

type ReconciliationPlan struct {
	ScopeToSA        map[rules.Scope]rules.ServiceAccountName
	SAToWSAMap       map[rules.ServiceAccountName]map[types.NamespacedName]rules.WSAResource
	WSAToSANames     map[types.NamespacedName][]rules.ServiceAccountName
	Vocabulary       *rules.GlobalVocabulary
	UniqueAccounts   []*v1.ServiceAccount
	AllResources     []rules.WSAResource
	TargetNamespaces []string
}

func (*ReconciliationPlan) GetSAToWSAMap

func (*ReconciliationPlan) GetScopeToSA

func (rp *ReconciliationPlan) GetScopeToSA() map[rules.Scope]rules.ServiceAccountName

func (*ReconciliationPlan) GetVocabulary

func (rp *ReconciliationPlan) GetVocabulary() *rules.GlobalVocabulary

type Stage

type Stage interface {
	Name() string
	Execute(ctx context.Context, batch *Batch) error
}

type StageOrchestrator

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

func NewStageOrchestrator

func NewStageOrchestrator(
	stages []Stage,
	collector *EventCollector,
	engine *rules.InMemoryEngine,
	c client.Client,
	stageTimeout time.Duration,
	recorder record.EventRecorder,
) *StageOrchestrator

func (*StageOrchestrator) NeedLeaderElection

func (so *StageOrchestrator) NeedLeaderElection() bool

func (*StageOrchestrator) Start

func (so *StageOrchestrator) Start(ctx context.Context) error

type ValidationError

type ValidationError struct {
	Type     string
	Resource string
	Message  string
}

type ValidationResult

type ValidationResult struct {
	Valid    bool
	Errors   []ValidationError
	Warnings []ValidationWarning
}

type ValidationWarning

type ValidationWarning struct {
	Type     string
	Resource string
	Message  string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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