types

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 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 BatchUpdateResult added in v0.3.0

type BatchUpdateResult struct {
	Results  []UpdateResult
	Started  int
	Finished int
	// contains filtered or unexported fields
}

BatchUpdateResult aggregates results from multiple update operations.

func NewBatchUpdateResult added in v0.3.0

func NewBatchUpdateResult() *BatchUpdateResult

NewBatchUpdateResult creates a new BatchUpdateResult.

func (*BatchUpdateResult) AddResult added in v0.3.0

func (br *BatchUpdateResult) AddResult(result UpdateResult)

AddResult adds an update result in a thread-safe manner.

func (*BatchUpdateResult) GetSummary added in v0.3.0

func (br *BatchUpdateResult) GetSummary() (total, success, failed int)

GetSummary returns a summary of the batch update results.

func (*BatchUpdateResult) IncrementStarted added in v0.3.0

func (br *BatchUpdateResult) IncrementStarted()

IncrementStarted increments the started counter in a thread-safe manner.

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.

func (DryRunAction) PlainString added in v0.3.0

func (a DryRunAction) PlainString() string

PlainString returns a plain string representation without color codes.

func (DryRunAction) Reason added in v0.3.0

func (a DryRunAction) Reason() string

Reason returns a human-readable reason for the action.

func (DryRunAction) String

func (a DryRunAction) String() string

String returns the plain, uncolored representation (see AMIStatus.String).

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.

func DefaultMonitorConfig added in v0.3.0

func DefaultMonitorConfig() MonitorConfig

DefaultMonitorConfig returns a MonitorConfig with sensible defaults.

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.

func (*ProgressMonitor) AllComplete added in v0.3.0

func (pm *ProgressMonitor) AllComplete() bool

AllComplete returns true if all updates have finished.

func (*ProgressMonitor) FailureCount added in v0.3.0

func (pm *ProgressMonitor) FailureCount() int

FailureCount returns the number of failed updates.

func (*ProgressMonitor) GetUpdates added in v0.3.0

func (pm *ProgressMonitor) GetUpdates() []UpdateProgress

GetUpdates returns a copy of all updates being monitored.

func (*ProgressMonitor) SuccessCount added in v0.3.0

func (pm *ProgressMonitor) SuccessCount() int

SuccessCount returns the number of successful updates.

func (*ProgressMonitor) UpdateStatus added in v0.3.0

func (pm *ProgressMonitor) UpdateStatus(nodegroupName string, status types.UpdateStatus, errorMsg string)

UpdateStatus updates the status of a specific nodegroup update.

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.

func (UpdateProgress) Duration added in v0.3.0

func (u UpdateProgress) Duration() time.Duration

Duration returns the time elapsed since the update started.

func (UpdateProgress) IsComplete added in v0.3.0

func (u UpdateProgress) IsComplete() bool

IsComplete returns true if the update has finished (success, failure, or cancelled).

func (UpdateProgress) IsSuccessful added in v0.3.0

func (u UpdateProgress) IsSuccessful() bool

IsSuccessful returns true if the update completed successfully.

type UpdateResult added in v0.3.0

type UpdateResult struct {
	NodegroupName string
	Success       bool
	UpdateID      string
	Error         error
	Duration      time.Duration
}

UpdateResult represents the result of an 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.

func (VersionInfo) String added in v0.3.0

func (v VersionInfo) String() string

String returns a formatted version string.

Jump to

Keyboard shortcuts

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