status

package
v1.3.2 Latest Latest
Warning

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

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

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

func NewManager(client client.Client) *Manager

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.

Jump to

Keyboard shortcuts

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