status

package
v0.1.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyImpulseTriggerStats

func ApplyImpulseTriggerStats(impulse *v1alpha1.Impulse, observedGeneration int64, stats ImpulseTriggerStats)

ApplyImpulseTriggerStats copies the aggregated stats onto the Impulse status while keeping timestamps monotonic.

func BuildStoryRunError

func BuildStoryRunError(reason, message string, failedSteps map[string]bool, stepStates map[string]runsv1alpha1.StepState) *k8sruntime.RawExtension

BuildStoryRunError constructs a structured error for StoryRun.status.error. The returned RawExtension can be assigned to srun.Status.Error before patching.

func PatchImpulsePhase

func PatchImpulsePhase(
	ctx context.Context,
	k8sClient client.Client,
	impulse *v1alpha1.Impulse,
	phase enums.Phase,
	message string,
) error

PatchImpulsePhase centralizes Impulse phase transitions by applying RetryableStatusPatch and keeping the Ready condition in sync with the new phase.

func PatchStepRunHandoff

func PatchStepRunHandoff(
	ctx context.Context,
	k8sClient client.Client,
	step *runsv1alpha1.StepRun,
	handoff *runsv1alpha1.HandoffStatus,
) error

PatchStepRunHandoff updates the StepRun handoff status in a retryable status patch.

func PatchStepRunPhase

func PatchStepRunPhase(
	ctx context.Context,
	k8sClient client.Client,
	step *runsv1alpha1.StepRun,
	phase enums.Phase,
	reason string,
	message string,
) error

PatchStepRunPhase centralizes StepRun phase transitions by mirroring the controller logic that stamps timestamps, duration metrics, and Ready-condition updates. Uses RetryableStatusPatch (merge patch) so only Phase, Conditions, and related fields are sent; Status.Output from the SDK is preserved and not overwritten.

func PatchStoryRunPhase

func PatchStoryRunPhase(
	ctx context.Context,
	k8sClient client.Client,
	srun *runsv1alpha1.StoryRun,
	phase enums.Phase,
	reason string,
	message string,
) error

PatchStoryRunPhase centralizes StoryRun phase transitions by cloning the controller-runtime status patch logic used across reconcilers. It stamps phase/message/observedGeneration, updates StartedAt/FinishedAt timestamps, records duration metrics, keeps the Ready condition in sync with the new phase, and marks trigger tokens for idempotent counting by Story/Impulse controllers. All side effects are applied via RetryableStatusPatch so concurrent reconciles observe consistent status snapshots.

func PatchStoryRunPhaseWithError

func PatchStoryRunPhaseWithError(
	ctx context.Context,
	k8sClient client.Client,
	srun *runsv1alpha1.StoryRun,
	phase enums.Phase,
	reason string,
	message string,
	statusErr *k8sruntime.RawExtension,
) error

PatchStoryRunPhaseWithError updates StoryRun phase and persists the supplied structured status error in the same status patch when provided.

Types

type ImpulseTriggerStats

type ImpulseTriggerStats struct {
	TriggersReceived int64
	StoriesLaunched  int64
	FailedTriggers   int64
	LastTrigger      *metav1.Time
	LastSuccess      *metav1.Time
}

ImpulseTriggerStats captures aggregated trigger counters + timestamps for an Impulse based on the StoryRuns that reference it.

func AggregateImpulseTriggerStats

func AggregateImpulseTriggerStats(impulse *v1alpha1.Impulse, runs []runsv1alpha1.StoryRun) ImpulseTriggerStats

AggregateImpulseTriggerStats scans StoryRuns and returns the aggregated counters/timestamps that should be recorded on the Impulse status.

Jump to

Keyboard shortcuts

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