nodegroup

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache = common.TTLCache

Cache is the nodegroup service's TTL cache, backed by the shared common.TTLCache implementation.

func NewCache

func NewCache() *Cache

NewCache creates a new cache instance. Callers always pass explicit TTLs to Set, so no default TTL is configured.

type DescribeOptions

type DescribeOptions struct {
	ShowInstances bool `json:"showInstances"`
	ShowWorkloads bool `json:"showWorkloads"`
}

DescribeOptions controls describe behavior for nodegroups

type EKSAPI

type EKSAPI interface {
	ListNodegroups(ctx context.Context, params *eks.ListNodegroupsInput, optFns ...func(*eks.Options)) (*eks.ListNodegroupsOutput, error)
	DescribeNodegroup(ctx context.Context, params *eks.DescribeNodegroupInput, optFns ...func(*eks.Options)) (*eks.DescribeNodegroupOutput, error)
	DescribeCluster(ctx context.Context, params *eks.DescribeClusterInput, optFns ...func(*eks.Options)) (*eks.DescribeClusterOutput, error)
	UpdateNodegroupConfig(ctx context.Context, params *eks.UpdateNodegroupConfigInput, optFns ...func(*eks.Options)) (*eks.UpdateNodegroupConfigOutput, error)
}

EKSAPI abstracts the subset of EKS client methods used for nodegroups.

type InstanceDetails

type InstanceDetails struct {
	InstanceID   string    `json:"instanceId"`
	InstanceType string    `json:"instanceType"`
	LaunchTime   time.Time `json:"launchTime"`
	Lifecycle    string    `json:"lifecycle"` // on-demand, spot
	State        string    `json:"state"`
	AZ           string    `json:"availabilityZone"`
}

InstanceDetails describes an EC2 instance backing a nodegroup.

type ListOptions

type ListOptions struct {
	Filters map[string]string `json:"filters"`
}

ListOptions controls nodegroup listing behavior

type NodegroupDetails

type NodegroupDetails struct {
	Name         string `json:"name"`
	Status       string `json:"status"`
	InstanceType string `json:"instanceType"`
	AmiType      string `json:"amiType"`
	CapacityType string `json:"capacityType"` // ON_DEMAND, SPOT

	// AMI information - core functionality of refresh tool
	CurrentAMI string          `json:"currentAmi"`
	LatestAMI  string          `json:"latestAmi"`
	AMIStatus  types.AMIStatus `json:"amiStatus"`

	Scaling ScalingConfig        `json:"scaling"`
	Health  *health.HealthStatus `json:"health,omitempty"`

	Instances []InstanceDetails `json:"instances"`
	Workloads WorkloadInfo      `json:"workloads"`
}

NodegroupDetails extends summary with health and optional instance/workload details

type NodegroupSummary

type NodegroupSummary struct {
	Name         string `json:"name"`
	Status       string `json:"status"`
	InstanceType string `json:"instanceType"`
	DesiredSize  int32  `json:"desiredSize"`
	// ReadyNodes is a measured count of Kubernetes Ready=True nodes, valid only
	// when ReadyKnown is true. When ReadyKnown is false the readiness was not
	// measured (no --check-readiness, or the cluster API was unreachable) and
	// ReadyNodes must not be read as a real count. (REF-130)
	ReadyNodes int32 `json:"readyNodes"`
	ReadyKnown bool  `json:"readyKnown"`
	// AMI information - core functionality of refresh tool
	CurrentAMI string          `json:"currentAmi"`
	AMIStatus  types.AMIStatus `json:"amiStatus"`
}

NodegroupSummary contains basic nodegroup info for listings

type ScaleOptions

type ScaleOptions struct {
	HealthCheck bool          `json:"healthCheck"`
	CheckPDBs   bool          `json:"checkPdbs"`
	Wait        bool          `json:"wait"`
	Timeout     time.Duration `json:"timeout"`
	DryRun      bool          `json:"dryRun"`
}

ScaleOptions controls intelligent scaling behavior

type ScalingConfig

type ScalingConfig struct {
	DesiredSize int32 `json:"desiredSize"`
	MinSize     int32 `json:"minSize"`
	MaxSize     int32 `json:"maxSize"`
	AutoScaling bool  `json:"autoScaling"`
}

ScalingConfig models the EKS managed nodegroup scaling configuration

type ServiceImpl

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

ServiceImpl is the nodegroup service.

func NewService

func NewService(awsConfig aws.Config, healthChecker *health.HealthChecker, logger *slog.Logger) *ServiceImpl

NewService creates a new nodegroup service.

func (*ServiceImpl) CheckInstanceTypeAvailability added in v0.8.0

func (s *ServiceImpl) CheckInstanceTypeAvailability(ctx context.Context, clusterName, nodegroupName string) ([]UnavailableOffering, error)

CheckInstanceTypeAvailability reports (instance type, AZ) combinations the nodegroup spans where EC2 doesn't offer the type — a pre-flight that catches "the ASG can't launch nodes in AZ X" before a scale-up or roll silently stalls. NOTE: this checks whether a type is *offered* in an AZ, not whether there is spare *capacity* right now — only a launch attempt reveals InsufficientInstanceCapacity.

func (*ServiceImpl) Describe

func (s *ServiceImpl) Describe(ctx context.Context, clusterName, nodegroupName string, options DescribeOptions) (*NodegroupDetails, error)

Describe returns expanded details for a single nodegroup.

func (*ServiceImpl) List

func (s *ServiceImpl) List(ctx context.Context, clusterName string, options ListOptions) ([]NodegroupSummary, error)

List returns basic nodegroup summaries for a cluster.

func (*ServiceImpl) PodDisruptionBudgets added in v0.7.0

func (s *ServiceImpl) PodDisruptionBudgets(ctx context.Context) ([]health.PDBInfo, error)

PodDisruptionBudgets returns the cluster's PDB disruption snapshot via the health checker, or (nil, nil) when no health checker / k8s client is wired. Used by `nodegroup scale --dry-run` to preview PDB impact. (REF-4)

func (*ServiceImpl) Scale

func (s *ServiceImpl) Scale(ctx context.Context, clusterName, nodegroupName string, desired, min, max *int32, options ScaleOptions) error

Scale updates the desired/min/max size for a nodegroup.

type UnavailableOffering added in v0.8.0

type UnavailableOffering struct {
	InstanceType     string `json:"instanceType" yaml:"instanceType"`
	AvailabilityZone string `json:"availabilityZone" yaml:"availabilityZone"`
}

UnavailableOffering is an (instance type, AZ) pair the nodegroup spans but where EC2 doesn't offer that instance type.

type WorkloadInfo

type WorkloadInfo struct {
	TotalPods     int    `json:"totalPods"`
	CriticalPods  int    `json:"criticalPods"`
	PodDisruption string `json:"podDisruption"` // summarized for now
}

WorkloadInfo summarizes pods/workloads placed on a nodegroup

Jump to

Keyboard shortcuts

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