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
- Variables
- type Provider
- func (p *Provider) DeleteNodes(_ context.Context, _ string) error
- func (p *Provider) GetClusterStatus(ctx context.Context, clusterName string) (*provider.ClusterStatus, error)
- func (p *Provider) ListAllClusters(ctx context.Context) ([]string, error)
- func (p *Provider) ListNodes(ctx context.Context, clusterName string) ([]provider.NodeInfo, error)
- func (p *Provider) NodesExist(ctx context.Context, clusterName string) (bool, error)
- func (p *Provider) Region() string
- func (p *Provider) StartNodes(ctx context.Context, clusterName string) error
- func (p *Provider) StopNodes(ctx context.Context, clusterName string) error
Constants ¶
const NodegroupStatusActive = "ACTIVE"
NodegroupStatusActive is the EKS nodegroup status that indicates the nodegroup is healthy and reconciling its desired capacity.
Variables ¶
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 ¶
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 ¶
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 ¶
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 ¶
NodesExist returns true if the cluster has at least one managed nodegroup.
func (*Provider) StartNodes ¶
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.