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 AvailableClusters(ctx context.Context, awsCfg aws.Config) ([]string, error)
- func CheckAWSCredentials(ctx context.Context, awsCfg aws.Config) error
- 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 LatestAmiIDForType(ctx context.Context, ssmClient *ssm.Client, k8sVersion string, ...) string
- func LatestReleaseVersionForType(ctx context.Context, ssmClient *ssm.Client, k8sVersion string, ...) string
- func ListAllPages[O, T any](ctx context.Context, operation string, ...) ([]T, error)
- func MatchingClusters(clusters []string, pattern string) []string
- func MatchingNodegroups(nodegroups []string, pattern string) []string
- func PrintCredentialHelp()
- func ValidateAWSCredentials(ctx context.Context, awsCfg aws.Config) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvailableClusters ¶ added in v0.5.0
AvailableClusters returns all EKS cluster names in the current region.
func CheckAWSCredentials ¶ added in v0.5.12
CheckAWSCredentials validates AWS credentials and, on failure, prints a red error message followed by credential setup guidance. It returns a sentinel error so callers can return immediately without further decoration.
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.
Classification order matters: context cancellation is user-initiated and needs no remediation help; typed API errors carry an authoritative error code and must win over substring heuristics (an IAM denial that mentions "region" in its message is not a region misconfiguration); substring matching is the last resort for transport/credential-chain failures that never reached the API.
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.3.0
IsPermissionError checks if the error is permissions-related.
func IsRegionError ¶ added in v0.3.0
IsRegionError checks if the error is related to AWS region configuration. Matching is deliberately narrow: many unrelated AWS errors merely mention a region name ("user is not authorized ... in region us-east-1"), and those must not be diagnosed as region misconfiguration.
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 LatestReleaseVersionForType ¶ added in v0.7.0
func LatestReleaseVersionForType(ctx context.Context, ssmClient *ssm.Client, k8sVersion string, amiType types.AMITypes) string
LatestReleaseVersionForType returns the latest recommended AMI *release version* (e.g. "1.31.0-20260601") for an AMI type — the human-meaningful counterpart of LatestAmiIDForType, used for changelog/version-delta display. Returns "" for custom AMIs or when the SSM parameter is unavailable.
func ListAllPages ¶ added in v0.7.0
func ListAllPages[O, T any]( ctx context.Context, operation string, call func(ctx context.Context, token *string) (O, error), extract func(O) (items []T, next *string), ) ([]T, error)
ListAllPages pages through an AWS list API, retrying each page call with common.DefaultRetryConfig and formatting failures with FormatAWSError. call fetches one page for the given token; extract pulls the items and the next token out of the page output.
It replaces the Paginate(WithRetry(...)) sandwich previously duplicated by every list-style service method, so the retry and error-formatting policy lives in one place.
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 PrintCredentialHelp ¶ added in v0.1.8
func PrintCredentialHelp()
PrintCredentialHelp displays helpful credential setup information.
Types ¶
This section is empty.