status

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package status aggregates fleet-wide EKS patch posture — Kubernetes version, support window, nodegroup AMI staleness, and addons-behind-latest — for the `refresh status` command. It reuses the cluster/nodegroup/addons services and is single-region; multi-region fan-out lives in the command layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddonAnalyzer

type AddonAnalyzer interface {
	List(ctx context.Context, clusterName string, options addons.ListOptions) ([]addons.AddonSummary, error)
	GetAvailableVersions(ctx context.Context, addonName, k8sVersion string) ([]addons.AddonVersionInfo, error)
}

AddonAnalyzer provides installed addons and their available versions. Satisfied by *addons.ServiceImpl.

type AddonsBehindSummary

type AddonsBehindSummary struct {
	Total  int      `json:"total" yaml:"total"`
	Behind int      `json:"behind" yaml:"behind"`
	Names  []string `json:"names,omitempty" yaml:"names,omitempty"`
}

AddonsBehindSummary summarizes addon version posture for a cluster.

type ClusterAPI

type ClusterAPI interface {
	ListClusters(ctx context.Context, in *eks.ListClustersInput, optFns ...func(*eks.Options)) (*eks.ListClustersOutput, error)
	DescribeCluster(ctx context.Context, in *eks.DescribeClusterInput, optFns ...func(*eks.Options)) (*eks.DescribeClusterOutput, error)
	DescribeClusterVersions(ctx context.Context, in *eks.DescribeClusterVersionsInput, optFns ...func(*eks.Options)) (*eks.DescribeClusterVersionsOutput, error)
}

ClusterAPI is the subset of the EKS API the status service calls directly.

type ClusterStatus

type ClusterStatus struct {
	Name           string              `json:"name" yaml:"name"`
	Region         string              `json:"region" yaml:"region"`
	Version        string              `json:"version" yaml:"version"`
	Support        SupportPosture      `json:"support" yaml:"support"`
	Compute        ComputeType         `json:"compute" yaml:"compute"`
	NodegroupCount int                 `json:"nodegroupCount" yaml:"nodegroupCount"`
	StaleAMI       StaleAMISummary     `json:"staleAmi" yaml:"staleAmi"`
	AddonsBehind   AddonsBehindSummary `json:"addonsBehind" yaml:"addonsBehind"`
	// HealthIssues is the count of AWS-reported control-plane health issues
	// (DescribeCluster Health.Issues) — degraded resources, IAM failures, etc.
	HealthIssues int `json:"healthIssues,omitempty" yaml:"healthIssues,omitempty"`
	// Errors holds non-fatal, per-cluster failures so a partial row still
	// renders instead of dropping the cluster entirely.
	Errors []string `json:"errors,omitempty" yaml:"errors,omitempty"`
}

ClusterStatus is the fleet-status row for a single cluster.

func (ClusterStatus) NeedsAttention

func (c ClusterStatus) NeedsAttention() bool

NeedsAttention reports whether the cluster has any stale AMIs or addons behind latest (drives the exit-code "something stale" signal).

func (ClusterStatus) SupportRisk

func (c ClusterStatus) SupportRisk() bool

SupportRisk reports whether the cluster is on extended or unsupported EKS (drives the exit-code "support risk" signal).

type ComputeType

type ComputeType string

ComputeType describes how a cluster provisions its worker nodes. It exists so `refresh status` never renders a nodegroup-less cluster as an empty row.

const (
	// ComputeManaged is the normal case: one or more managed nodegroups.
	ComputeManaged ComputeType = "managed-nodegroups"
	// ComputeAutoMode is EKS Auto Mode (AWS manages compute and AMIs).
	ComputeAutoMode ComputeType = "auto-mode"
	// ComputeKarpenter is a nodegroup-less cluster with Karpenter signals.
	ComputeKarpenter ComputeType = "karpenter"
	// ComputeNone is a cluster with no managed nodegroups and no detected
	// alternative compute provider.
	ComputeNone ComputeType = "none"
)

type EC2API

type EC2API interface {
	DescribeImages(ctx context.Context, in *ec2.DescribeImagesInput, optFns ...func(*ec2.Options)) (*ec2.DescribeImagesOutput, error)
	DescribeInstances(ctx context.Context, in *ec2.DescribeInstancesInput, optFns ...func(*ec2.Options)) (*ec2.DescribeInstancesOutput, error)
}

EC2API is the optional EC2 subset used for AMI age and Karpenter detection.

type FleetStatus

type FleetStatus struct {
	Clusters []ClusterStatus `json:"clusters" yaml:"clusters"`
}

FleetStatus is the aggregate posture across clusters and regions — the payload serialized for json/yaml output.

type ListOptions

type ListOptions struct {
	NamePattern    string
	MaxConcurrency int
}

ListOptions controls cluster selection for a single-region status sweep.

type NodegroupLister

type NodegroupLister interface {
	List(ctx context.Context, clusterName string, options nodegroup.ListOptions) ([]nodegroup.NodegroupSummary, error)
}

NodegroupLister provides per-cluster nodegroup summaries (with AMI status). Satisfied by *nodegroup.ServiceImpl.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service aggregates fleet patch posture for a single region.

func NewService

func NewService(awsCfg aws.Config, logger *slog.Logger) *Service

NewService builds a region-scoped status service from an AWS config, wiring the concrete cluster/nodegroup/addons/ec2 clients.

func (*Service) ListClusterStatuses

func (s *Service) ListClusterStatuses(ctx context.Context, opts ListOptions) ([]ClusterStatus, error)

ListClusterStatuses returns the patch posture of every cluster in the service's region (optionally filtered by NamePattern). Per-cluster failures are recorded on the row rather than failing the whole sweep.

type StaleAMISummary

type StaleAMISummary struct {
	Total  int `json:"total" yaml:"total"`
	Behind int `json:"behind" yaml:"behind"`
	// OldestDays is the age of the oldest stale AMI in days, when resolvable.
	OldestDays *int `json:"oldestDays,omitempty" yaml:"oldestDays,omitempty"`
}

StaleAMISummary summarizes nodegroup AMI posture for a cluster.

type SupportPosture

type SupportPosture struct {
	Tier          SupportTier `json:"tier" yaml:"tier"`
	StandardUntil *time.Time  `json:"standardUntil,omitempty" yaml:"standardUntil,omitempty"`
	ExtendedUntil *time.Time  `json:"extendedUntil,omitempty" yaml:"extendedUntil,omitempty"`
	// DaysRemaining counts down to the end of the current tier (standard or
	// extended). Negative once the window has closed.
	DaysRemaining *int `json:"daysRemaining,omitempty" yaml:"daysRemaining,omitempty"`
	// ExtraCostUSDPerHour is the per-cluster premium of the current tier over
	// standard support (0 unless extended).
	ExtraCostUSDPerHour float64 `json:"extraCostUsdPerHour,omitempty" yaml:"extraCostUsdPerHour,omitempty"`
	// Fallback is true when the posture came from the compiled-in calendar
	// because DescribeClusterVersions was unavailable.
	Fallback bool `json:"fallback,omitempty" yaml:"fallback,omitempty"`
}

SupportPosture is the resolved support window for a cluster's version.

type SupportResolver added in v0.8.0

type SupportResolver struct {
	// contains filtered or unexported fields
}

SupportResolver resolves EKS version support posture — the same logic behind `refresh status` — for reuse by `cluster upgrade-check` and `cluster describe`. Stateless apart from the EKS client; safe to construct per command.

func NewSupportResolver added in v0.8.0

func NewSupportResolver(api supportVersionsAPI) *SupportResolver

NewSupportResolver builds a resolver over an EKS client (anything exposing DescribeClusterVersions).

func (*SupportResolver) Resolve added in v0.8.0

func (r *SupportResolver) Resolve(ctx context.Context, version string) SupportPosture

Resolve returns the support posture for a Kubernetes version (e.g. "1.32"), falling back to the compiled-in calendar when DescribeClusterVersions is unavailable.

type SupportTier

type SupportTier string

SupportTier is the EKS support posture for a cluster's Kubernetes version.

const (
	SupportStandard    SupportTier = "standard"
	SupportExtended    SupportTier = "extended"
	SupportUnsupported SupportTier = "unsupported"
	SupportUnknown     SupportTier = "unknown"
)

Jump to

Keyboard shortcuts

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