Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles WorkflowExecution status updates with atomic operations Implements DD-PERF-001: Atomic Status Updates mandate
This manager reduces K8s API calls by consolidating multiple status field updates into a single atomic operation, improving performance and reducing race conditions.
func NewManager ¶
NewManager creates a new status manager
func (*Manager) AtomicStatusUpdate ¶
func (m *Manager) AtomicStatusUpdate( ctx context.Context, wfe *workflowexecutionv1alpha1.WorkflowExecution, updateFunc func() error, ) error
AtomicStatusUpdate atomically updates phase and status fields in a single API call This prevents race conditions and reduces API server load (1 write instead of N writes)
This method consolidates: - Phase transition - Multiple status field updates (Duration, CompletionTime, FailureDetails, etc.) - Condition updates (TektonPipelineComplete, audit conditions, etc.)
Satisfies BR-WE-003, BR-WE-006, and improves performance by 50%+ (DD-PERF-001)
Example Usage:
err := m.AtomicStatusUpdate(ctx, wfe, func() error {
// Update phase
wfe.Status.Phase = workflowexecutionv1alpha1.PhaseCompleted
wfe.Status.CompletionTime = &now
wfe.Status.Duration = duration.String()
// Update conditions
weconditions.SetTektonPipelineComplete(wfe, true, ...)
weconditions.SetAuditRecorded(wfe, true, ...)
return nil
})
func (*Manager) UpdatePhase ¶
func (m *Manager) UpdatePhase( ctx context.Context, wfe *workflowexecutionv1alpha1.WorkflowExecution, newPhase string, ) error
UpdatePhase updates the WorkflowExecution phase with validation Satisfies BR-WE-003: CRD Lifecycle Management
NOTE: For phase transitions that include multiple field updates, use AtomicStatusUpdate instead to reduce API calls and eliminate race conditions.
This method uses retry logic to handle optimistic locking conflicts.