types

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: 5 Imported by: 0

Documentation

Overview

Package types provides core data types used throughout the refresh CLI tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AMIStatus

type AMIStatus int

AMIStatus represents the status of a nodegroup's AMI relative to the latest available.

const (
	// AMILatest indicates the nodegroup is using the latest AMI.
	AMILatest AMIStatus = iota
	// AMIOutdated indicates the nodegroup is using an older AMI.
	AMIOutdated
	// AMIUpdating indicates the nodegroup is currently being updated.
	AMIUpdating
	// AMIUnknown indicates the AMI status could not be determined.
	AMIUnknown
	// AMICustom indicates the nodegroup runs a custom AMI (AmiType=CUSTOM) whose
	// AMI is managed via the user's launch template, not by EKS. refresh can't
	// pick a recommended AMI for these, so they are neither "latest" nor "stale".
	AMICustom
)

func (AMIStatus) ColorString added in v0.7.0

func (s AMIStatus) ColorString() string

ColorString returns a color-coded representation for terminal display.

func (AMIStatus) MarshalJSON added in v0.7.0

func (s AMIStatus) MarshalJSON() ([]byte, error)

MarshalJSON emits the plain string ("Latest", "Outdated", ...) instead of a bare enum int, so `-o json` consumers get a meaningful value.

func (AMIStatus) NeedsUpdate added in v0.3.0

func (s AMIStatus) NeedsUpdate() bool

NeedsUpdate returns true if the nodegroup should be updated.

func (AMIStatus) PlainString added in v0.3.0

func (s AMIStatus) PlainString() string

PlainString returns a plain string representation without color codes.

func (AMIStatus) String

func (s AMIStatus) String() string

String returns the plain, uncolored representation. Presentation (color) lives in ColorString so that %v formatting, logs, and serialization never emit ANSI escape codes.

func (*AMIStatus) UnmarshalJSON added in v0.7.0

func (s *AMIStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts the plain-string form produced by MarshalJSON (and the legacy integer form).

type DryRunAction

type DryRunAction int

DryRunAction represents the action that would be taken in dry run mode.

const (
	// ActionUpdate indicates the nodegroup will be updated.
	ActionUpdate DryRunAction = iota
	// ActionSkipUpdating indicates the nodegroup is already updating.
	ActionSkipUpdating
	// ActionSkipLatest indicates the nodegroup is already at the latest AMI.
	ActionSkipLatest
	// ActionForceUpdate indicates the nodegroup will be force-updated.
	ActionForceUpdate
)

func (DryRunAction) ColorString added in v0.7.0

func (a DryRunAction) ColorString() string

ColorString returns a color-coded representation for terminal display.

type MonitorConfig

type MonitorConfig struct {
	PollInterval    time.Duration
	MaxRetries      int
	BackoffMultiple float64
	Quiet           bool
	NoWait          bool
	Timeout         time.Duration
}

MonitorConfig contains configuration for the update monitoring process.

type NodegroupInfo

type NodegroupInfo struct {
	Name         string
	Status       string
	InstanceType string
	Desired      int32
	CurrentAmi   string
	AmiStatus    AMIStatus
}

NodegroupInfo contains essential information about an EKS nodegroup.

type ProgressMonitor

type ProgressMonitor struct {
	Updates     []UpdateProgress
	StartTime   time.Time
	Quiet       bool
	NoWait      bool
	Timeout     time.Duration
	LastPrinted int
	// contains filtered or unexported fields
}

ProgressMonitor manages the monitoring of multiple concurrent nodegroup updates. It is thread-safe through the use of sync.RWMutex.

func NewProgressMonitor added in v0.3.0

func NewProgressMonitor(quiet, noWait bool, timeout time.Duration) *ProgressMonitor

NewProgressMonitor creates a new progress monitor with the specified configuration.

func (*ProgressMonitor) AddUpdate added in v0.3.0

func (pm *ProgressMonitor) AddUpdate(update UpdateProgress)

AddUpdate adds a new update to be monitored in a thread-safe manner.

type UpdateProgress

type UpdateProgress struct {
	NodegroupName string
	UpdateID      string
	ClusterName   string
	Status        types.UpdateStatus
	StartTime     time.Time
	LastChecked   time.Time
	// ErrorMessage holds errors reported by the AWS update itself.
	ErrorMessage string
	// LastCheckError holds a transient status-polling failure (throttle,
	// network blip). It is display-only: the update may well still be running
	// in AWS, so it must not be rendered as a FAILED update.
	LastCheckError string
}

UpdateProgress tracks the progress of a nodegroup update operation.

type VersionInfo

type VersionInfo struct {
	Version   string `json:"version"`
	Commit    string `json:"commit,omitempty"`
	BuildDate string `json:"build_date,omitempty"`
}

VersionInfo contains version information for the CLI tool.

Jump to

Keyboard shortcuts

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