Documentation
¶
Overview ¶
Package stackdrift periodically plans each stack's latest applied revision against live state and records whether they still match (ADR 042). It only reads: nothing here applies a plan or writes a live resource.
Index ¶
Constants ¶
View Source
const ( EnvInterval = "APP_STACK_DRIFT_INTERVAL" EnvSummaryMax = "APP_STACK_DRIFT_SUMMARY_MAX" DefaultInterval = 15 * time.Minute )
Env names for the loop. APP_STACK_DRIFT_INTERVAL=0 turns it off.
View Source
const ( ActionChanged = "changed" ActionMissing = "missing" ActionOwnerChanged = "owner_changed" )
Item actions in a drift summary.
Variables ¶
This section is empty.
Functions ¶
func IntervalFromEnv ¶
IntervalFromEnv reads APP_STACK_DRIFT_INTERVAL; 0 disables the loop and an unset or invalid value falls back to the default.
Types ¶
type Checker ¶
type Checker struct {
Store Store
Live OpenLive
// ProjectName resolves a stack's project id to the name documents use.
ProjectName func(ctx context.Context, id string) string
Logger *slog.Logger
Now func() time.Time
// StartDelay is the wait before the first pass after boot.
StartDelay time.Duration
}
Checker records drift for every stack.
type OpenLive ¶
OpenLive returns a read-only client for live state and a release func the checker calls when the pass is done.
type Store ¶
type Store interface {
ListStacks(ctx context.Context) ([]store.StackRecord, error)
ListStackRevisions(ctx context.Context, stackID string, limit int) ([]store.StackRevisionRecord, error)
GetStackRevision(ctx context.Context, stackID string, number int) (store.StackRevisionRecord, error)
ListStackLedger(ctx context.Context, stackID string) ([]store.StackLedgerEntry, error)
GetStackResourceOwner(ctx context.Context, kind, key string) (store.StackLedgerEntry, bool, error)
SetStackDrift(ctx context.Context, d store.StackDrift) error
}
Store is the store surface the checker uses.
Click to show internal directories.
Click to hide internal directories.