stuck

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Overview

Package stuck explains why a reconciled resource is not ready, by mapping condition reasons plus nearby context to a plain-language cause, evidence lines and typed next actions. Pure and deterministic: no AI, no I/O.

Index

Constants

View Source
const (
	KindApp      = "app"
	KindDatabase = "database"
	KindDomain   = "domain"
	KindNode     = "node"
)

Resource kinds Explain understands.

View Source
const (
	ActionFix         = "fix"
	ActionRecheck     = "recheck"
	ActionLogs        = "logs"
	ActionRetryDeploy = "retry_deploy"
	ActionLink        = "link"
)

Action types a Cause can carry.

View Source
const (
	ConfidenceHigh   = "high"
	ConfidenceMedium = "medium"
)

Confidence values.

View Source
const (
	CauseDiskFull        = "DISK_FULL"
	CauseNodeOffline     = "NODE_OFFLINE"
	CauseNodePending     = "NODE_PENDING"
	CauseImagePull       = "IMAGE_PULL_FAILED"
	CausePortConflict    = "PORT_CONFLICT"
	CauseReadiness       = "READINESS_FAILING"
	CauseCrashloop       = "CRASHLOOP"
	CauseMissingSecret   = "MISSING_SECRET"
	CauseDependency      = "DEPENDENCY_NOT_READY"
	CausePlacement       = "PLACEMENT_IMPOSSIBLE"
	CauseOperationFailed = "OPERATION_FAILED"
	CauseNotReconciled   = "NOT_RECONCILED_YET"
)

Cause codes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Type  string `json:"type"`
	Label string `json:"label"`
	FixID string `json:"fix_id,omitempty"`
	Href  string `json:"href,omitempty"`
}

Action is one typed next step.

type Cause

type Cause struct {
	Code        string   `json:"code"`
	Title       string   `json:"title"`
	Explanation string   `json:"explanation"`
	Confidence  string   `json:"confidence"`
	Evidence    []string `json:"evidence"`
	Actions     []Action `json:"actions"`
}

Cause is one ranked likely reason with its supporting evidence.

type Condition

type Condition struct {
	Type    string    `json:"type"`
	Status  string    `json:"status"`
	Reason  string    `json:"reason"`
	Message string    `json:"message,omitempty"`
	Since   time.Time `json:"since"`
}

Condition is one reconcile condition with the time it entered its state.

type Context

type Context struct {
	LastError          string
	RecentEvents       []string
	NodeStatus         string
	DiskCritical       bool
	DiskDetail         string
	Crashloop          bool
	DependencyNotReady string
	// Href maps a destination name (logs, node, environment, registries) to a dashboard path.
	Href map[string]string
}

Context is everything beyond the conditions that can explain a stall.

type Input

type Input struct {
	Kind, Name string
	Conditions []Condition
	Ctx        Context
	Now        time.Time
	Threshold  time.Duration
}

Input is one resource to explain.

type Report

type Report struct {
	Kind            string      `json:"kind"`
	Name            string      `json:"name"`
	Ready           bool        `json:"ready"`
	Stuck           bool        `json:"stuck"`
	NotReadySince   *time.Time  `json:"not_ready_since,omitempty"`
	NotReadySeconds int64       `json:"not_ready_seconds"`
	ThresholdSecs   int64       `json:"threshold_seconds"`
	Timeline        []Condition `json:"timeline"`
	Causes          []Cause     `json:"causes"`
}

Report is the full explanation.

func Explain

func Explain(in Input) Report

Explain builds the report for in. A resource whose Ready condition is True yields a healthy report with no causes.

Jump to

Keyboard shortcuts

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