Help us shape the future of Go! Take the 2026 Go Developer Survey

lifecycle

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package lifecycle holds the controller's seat lifecycle decision (contracts.md "Lifecycle decisions"). Decide is a pure function of the observed seat, backend and platform runtime state and the current time.

Index

Constants

View Source
const (
	PolicyWarm         = "warm"
	PolicyWarmThenStop = "warm_then_stop"
)

Idle policies.

View Source
const (
	ReasonRetired           = "Retired"
	ReasonRetiring          = "Retiring"
	ReasonAdminSuspended    = "AdminSuspended"
	ReasonPendingDeliveries = "PendingDeliveries"
	ReasonProbe             = "SyntheticProbe"
	ReasonIdle              = "IdleTimeout"
	ReasonConfigChanged     = "ConfigRevisionChanged"
	ReasonFencing           = "FencingPreviousExecution"
	ReasonPodFailed         = "PodFailed"
	ReasonStarting          = "Starting"
	ReasonStopping          = "Stopping"
	ReasonStopped           = "Stopped"
	ReasonRunning           = "Running"
	ReasonImageUnavailable  = "HarnessImageUnavailable"
)

Reasons reported with the execution state.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	// Replicas is the desired replica count (0 or 1).
	Replicas int32
	// DeletePod names a Pod to delete gracefully (safe-boundary restart).
	DeletePod string
	// Fence requests POST /internal/v1/seats/{id}/fence with FenceGeneration,
	// once FenceHolder has been confirmed gone with a live read.
	Fence           bool
	FenceGeneration int64
	FenceHolder     string
	State           v1alpha1.ExecutionState
	Reason          string
	Message         string
	// RequeueAfter asks for re-evaluation (e.g. at the idle deadline).
	RequeueAfter time.Duration
}

Action is the decision.

func Decide

func Decide(in Input) Action

Decide returns the lifecycle action for a seat.

type Input

type Input struct {
	Now            time.Time
	Retired        bool
	AdminSuspended bool
	// Blocked is a backend validation failure; nil when the seat can run.
	Blocked        error
	IdlePolicy     string
	IdleTimeout    time.Duration
	ConfigRevision string
	// Backend is the observed backend state (nil before the first ensure).
	Backend *seatruntime.Status
	// Runtime is the platform's view of the seat (nil when unknown).
	Runtime *runtimeapi.SeatRuntime
	// ProbePending means a synthetic probe for this revision needs the seat running.
	ProbePending bool
}

Input is everything Decide needs.

Jump to

Keyboard shortcuts

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