Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@ const (
AmazonLinux EKSAMILookupType = "AmazonLinux"
// AmazonLinuxGPU is the AmazonLinux GPU AMI type.
AmazonLinuxGPU EKSAMILookupType = "AmazonLinuxGPU"
// AmazonLinux2023 is the AmazonLinux 2023 AMI type.
AmazonLinux2023 EKSAMILookupType = "AmazonLinux2023"
// AmazonLinux2023GPU is the AmazonLinux 2023 GPU AMI type.
AmazonLinux2023GPU EKSAMILookupType = "AmazonLinux2023GPU"
)

// PrivateDNSName is the options for the instance hostname.
Expand Down
23 changes: 21 additions & 2 deletions pkg/cloud/services/ec2/ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,20 @@ const (
// EKS AMI ID SSM Parameter name.
eksAmiSSMParameterFormat = "/aws/service/eks/optimized-ami/%s/amazon-linux-2/recommended/image_id"

// EKS AL2023 AMI ID SSM Parameter name.
eksAmiAl2023SSMParameterFormat = "/aws/service/eks/optimized-ami/%s/amazon-linux-2023/x86_64/standard/recommended/image_id"

// EKS ARM64 AMI ID SSM Parameter name.
eksARM64AmiSSMParameterFormat = "/aws/service/eks/optimized-ami/%s/amazon-linux-2-arm64/recommended/image_id"

// EKS ARM64 AL2023 AMI ID SSM Parameter name.
eksARM64AmiAl2023SSMParameterFormat = "/aws/service/eks/optimized-ami/%s/amazon-linux-2023/arm64/standard/recommended/image_id"

// EKS GPU AMI ID SSM Parameter name.
eksGPUAmiSSMParameterFormat = "/aws/service/eks/optimized-ami/%s/amazon-linux-2-gpu/recommended/image_id"

// EKS GPU AL2023 AMI ID SSM Parameter name.
eksGPUAmiAl2023SSMParameterFormat = "/aws/service/eks/optimized-ami/%s/amazon-linux-2023/x86_64/nvidia/recommended/image_id"
)

// AMILookup contains the parameters used to template AMI names used for lookup.
Expand Down Expand Up @@ -323,14 +332,24 @@ func (s *Service) eksAMILookup(kubernetesVersion string, architecture string, am
}

switch *amiType {
case infrav1.AmazonLinux2023GPU:
paramName = fmt.Sprintf(eksGPUAmiAl2023SSMParameterFormat, formattedVersion)
case infrav1.AmazonLinuxGPU:
paramName = fmt.Sprintf(eksGPUAmiSSMParameterFormat, formattedVersion)
default:
switch architecture {
case Arm64ArchitectureTag:
paramName = fmt.Sprintf(eksARM64AmiSSMParameterFormat, formattedVersion)
if *amiType == infrav1.AmazonLinux2023 {
paramName = fmt.Sprintf(eksARM64AmiAl2023SSMParameterFormat, formattedVersion)
} else {
paramName = fmt.Sprintf(eksARM64AmiSSMParameterFormat, formattedVersion)
}
case Amd64ArchitectureTag:
paramName = fmt.Sprintf(eksAmiSSMParameterFormat, formattedVersion)
if *amiType == infrav1.AmazonLinux2023 {
paramName = fmt.Sprintf(eksAmiAl2023SSMParameterFormat, formattedVersion)
} else {
paramName = fmt.Sprintf(eksAmiSSMParameterFormat, formattedVersion)
}
default:
return "", fmt.Errorf("cannot look up eks-optimized image for architecture %q", architecture)
}
Expand Down
Loading