aws

package
v7.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package aws implements the KSail Provider interface for Amazon EKS clusters.

The AWS provider is a thin layer over the eksctl CLI wrapper in pkg/client/eksctl. All infrastructure operations (list clusters, list nodegroups, scale nodegroups) are delegated to eksctl, which in turn uses CloudFormation and the EKS/EC2 AWS APIs.

Lifecycle semantics differ from the Docker and Hetzner providers:

  • EKS control planes cannot be "stopped". StartNodes/StopNodes therefore scale managed nodegroups to and from zero desired capacity, respectively.
  • DeleteNodes is a no-op because `eksctl delete cluster` already deletes all owned nodegroups via CloudFormation.

Credentials are resolved by eksctl itself through the standard AWS SDK v2 credential chain (env vars, ~/.aws/credentials, IMDS, SSO, etc.). KSail does not interact with AWS credentials directly.

Index

Constants

View Source
const NodegroupStatusActive = "ACTIVE"

NodegroupStatusActive is the EKS nodegroup status that indicates the nodegroup is healthy and reconciling its desired capacity.

Variables

View Source
var ErrClientRequired = errors.New("aws provider: eksctl client is required")

ErrClientRequired is returned when a Provider is constructed without an eksctl client. NewProvider rejects nil clients to keep the zero value of Provider safe (all methods return ErrProviderUnavailable).

Functions

This section is empty.

Types

type Provider

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

Provider implements provider.Provider for Amazon EKS via eksctl.

func NewProvider

func NewProvider(client *eksctlclient.Client, region string) (*Provider, error)

NewProvider returns a Provider using the given eksctl client and AWS region. Pass region="" to defer to eksctl's own region resolution (AWS_REGION env, active AWS profile, etc.). A nil client returns ErrClientRequired so callers can fail fast rather than getting ErrProviderUnavailable at the first call.

func (*Provider) DeleteNodes

func (p *Provider) DeleteNodes(_ context.Context, _ string) error

DeleteNodes is a no-op for EKS: `eksctl delete cluster` deletes all owned CloudFormation stacks (including managed nodegroups) atomically. Callers that need partial deletion should invoke the provisioner directly.

func (*Provider) GetClusterStatus

func (p *Provider) GetClusterStatus(
	ctx context.Context,
	clusterName string,
) (*provider.ClusterStatus, error)

GetClusterStatus aggregates nodegroup statuses into a provider.ClusterStatus. Returns provider.ErrClusterNotFound when the cluster does not exist in EKS.

func (*Provider) ListAllClusters

func (p *Provider) ListAllClusters(ctx context.Context) ([]string, error)

ListAllClusters returns the names of all EKS clusters visible in the configured region (or the default region eksctl resolves when region is "").

func (*Provider) ListNodes

func (p *Provider) ListNodes(ctx context.Context, clusterName string) ([]provider.NodeInfo, error)

ListNodes returns one NodeInfo per managed nodegroup for the cluster.

EKS nodegroups are not individual nodes — they are ASG-backed groups — so KSail collapses the distinction and represents each nodegroup as a single NodeInfo whose Name is the nodegroup name. Downstream consumers that need instance-level detail should call the AWS SDK directly.

func (*Provider) NodesExist

func (p *Provider) NodesExist(ctx context.Context, clusterName string) (bool, error)

NodesExist returns true if the cluster has at least one managed nodegroup.

func (*Provider) Region

func (p *Provider) Region() string

Region returns the AWS region this provider was configured with.

func (*Provider) StartNodes

func (p *Provider) StartNodes(ctx context.Context, clusterName string) error

StartNodes scales all managed nodegroups for the cluster back to their configured desired capacity if it is currently zero. Nodegroups already at non-zero desired capacity are left alone.

When a nodegroup's desired capacity is zero, this method does not know the "correct" target size to scale up to, so it defers to the max(MinSize, 1) that eksctl returned. The provisioner — which has the ksail.yaml spec — is responsible for restoring the exact DesiredCapacity when needed.

func (*Provider) StopNodes

func (p *Provider) StopNodes(ctx context.Context, clusterName string) error

StopNodes scales all managed nodegroups to zero desired capacity. The cluster control plane remains running (EKS bills $0.10/hour for it) but all node-hour costs stop.

Jump to

Keyboard shortcuts

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