Documentation
¶
Overview ¶
Package aws provides AWS SDK abstractions and utilities for EKS cluster management. It implements clean patterns for AMI resolution, cluster discovery, and error handling.
Index ¶
- func ClusterName(ctx context.Context, awsCfg aws.Config, cliFlag string) (string, error)
- func ConfirmNodegroupSelection(matches []string, pattern string) ([]string, error)
- func CurrentAmiID(ctx context.Context, ng *types.Nodegroup, ec2Client *ec2.Client, ...) string
- func FormatAWSError(err error, operation string) error
- func IsCredentialError(err error) bool
- func IsNetworkError(err error) bool
- func IsPermissionError(err error) bool
- func IsRegionError(err error) bool
- func LatestAmiID(ctx context.Context, ssmClient *ssm.Client, k8sVersion string) string
- func LatestAmiIDForType(ctx context.Context, ssmClient *ssm.Client, k8sVersion string, ...) string
- func MatchingClusters(clusters []string, pattern string) []string
- func MatchingNodegroups(nodegroups []string, pattern string) []string
- func Nodegroups(ctx context.Context, awsCfg aws.Config, clusterName string) ([]refreshTypes.NodegroupInfo, error)
- func PrintCredentialHelp()
- func ValidateAWSCredentials(ctx context.Context, awsCfg aws.Config) error
- type AMICache
- type AMIResolver
- type AWSError
- type ClusterResolver
- type ErrorCategory
- type NodegroupClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClusterName ¶
ClusterName resolves the EKS cluster name from CLI flag or kubeconfig. It supports partial name matching and prompts for confirmation when multiple matches exist.
func ConfirmNodegroupSelection ¶
ConfirmNodegroupSelection prompts user to confirm when multiple nodegroups match. Returns the selected nodegroups or error if user cancels.
func CurrentAmiID ¶
func CurrentAmiID(ctx context.Context, ng *types.Nodegroup, ec2Client *ec2.Client, autoscalingClient *autoscaling.Client) string
CurrentAmiID resolves the current AMI ID for a nodegroup. It attempts resolution in order: launch template, then ASG instance.
func FormatAWSError ¶ added in v0.1.8
FormatAWSError provides user-friendly error messages for AWS errors.
func IsCredentialError ¶ added in v0.1.8
IsCredentialError checks if the error is related to AWS credentials.
func IsNetworkError ¶ added in v0.1.8
IsNetworkError checks if the error is network-related.
func IsPermissionError ¶ added in v0.4.1
IsPermissionError checks if the error is permissions-related.
func IsRegionError ¶ added in v0.4.1
IsRegionError checks if the error is related to AWS region configuration.
func LatestAmiID ¶
LatestAmiID returns the latest recommended AMI ID for a given Kubernetes version. It defaults to AL2 x86_64 for backward compatibility.
func LatestAmiIDForType ¶ added in v0.2.2
func LatestAmiIDForType(ctx context.Context, ssmClient *ssm.Client, k8sVersion string, amiType types.AMITypes) string
LatestAmiIDForType returns the latest recommended AMI ID for a specific AMI type. It queries AWS SSM Parameter Store for the EKS-optimized AMI. Supports AL2, AL2023, Bottlerocket, and Windows AMI types.
func MatchingClusters ¶
MatchingClusters returns cluster names that contain the given pattern. If pattern is empty, returns all clusters.
func MatchingNodegroups ¶
MatchingNodegroups returns nodegroup names that contain the given pattern. If pattern is empty, returns all nodegroups.
func Nodegroups ¶
func Nodegroups(ctx context.Context, awsCfg aws.Config, clusterName string) ([]refreshTypes.NodegroupInfo, error)
Nodegroups retrieves all nodegroups for a cluster with their AMI status.
func PrintCredentialHelp ¶ added in v0.1.8
func PrintCredentialHelp()
PrintCredentialHelp displays helpful credential setup information.
Types ¶
type AMICache ¶ added in v0.4.1
type AMICache struct {
// contains filtered or unexported fields
}
AMICache provides thread-safe caching for AMI lookups.
func NewAMICache ¶ added in v0.4.1
func NewAMICache() *AMICache
NewAMICache creates a new AMI cache instance.
type AMIResolver ¶ added in v0.4.1
type AMIResolver struct {
// contains filtered or unexported fields
}
AMIResolver handles AMI ID resolution for EKS nodegroups. It supports caching to reduce API calls for repeated lookups.
func NewAMIResolver ¶ added in v0.4.1
func NewAMIResolver(ec2Client *ec2.Client, autoscalingClient *autoscaling.Client, ssmClient *ssm.Client) *AMIResolver
NewAMIResolver creates a new AMI resolver with the provided AWS clients.
type AWSError ¶ added in v0.4.1
type AWSError struct {
Operation string
Err error
Category ErrorCategory
}
AWSError wraps an error with AWS-specific context.
type ClusterResolver ¶ added in v0.4.1
type ClusterResolver struct {
// contains filtered or unexported fields
}
ClusterResolver handles cluster name resolution and matching.
func NewClusterResolver ¶ added in v0.4.1
func NewClusterResolver(awsCfg aws.Config) *ClusterResolver
NewClusterResolver creates a new cluster resolver.
type ErrorCategory ¶ added in v0.4.1
type ErrorCategory int
ErrorCategory classifies the type of AWS error.
const ( ErrorCategoryUnknown ErrorCategory = iota ErrorCategoryCredential ErrorCategoryNetwork ErrorCategoryPermission ErrorCategoryRegion ErrorCategoryAPI )
type NodegroupClient ¶ added in v0.4.1
type NodegroupClient struct {
// contains filtered or unexported fields
}
NodegroupClient handles nodegroup operations.
func NewNodegroupClient ¶ added in v0.4.1
func NewNodegroupClient(awsCfg aws.Config) *NodegroupClient
NewNodegroupClient creates a new nodegroup client.