Skip to content

Commit

Permalink
Add support for ARM AMI type in managed node group (#246)
Browse files Browse the repository at this point in the history
- Add support for ARM AMI type in managed node group creation
  • Loading branch information
vikasmb authored Feb 1, 2022
1 parent 39044a6 commit 26909f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions eksconfig/add-on-managed-node-groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ type MNG struct {
ReleaseVersionValue float64 `json:"release-version-value" read-only:"true"`

// AMIType is the AMI type for the node group.
// Allowed values are AL2_x86_64 and AL2_x86_64_GPU.
// Allowed values are AL2_x86_64, AL2_x86_64_GPU and AL2_ARM_64.
// ref. https://docs.aws.amazon.com/eks/latest/userguide/create-managed-node-group.html
// ref. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-nodegroup.html
// ref. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-nodegroup.html#cfn-eks-nodegroup-amitype
AMIType string `json:"ami-type,omitempty"`

// InstanceTypes is the EC2 instance types for the node instances.
Expand Down Expand Up @@ -404,6 +404,10 @@ func (cfg *Config) validateAddOnManagedNodeGroups() error {
if cur.RemoteAccessUserName != "ec2-user" {
return fmt.Errorf("AMIType %q but unexpected RemoteAccessUserName %q", cur.AMIType, cur.RemoteAccessUserName)
}
case eks.AMITypesAl2Arm64:
if cur.RemoteAccessUserName != "ec2-user" {
return fmt.Errorf("AMIType %q but unexpected RemoteAccessUserName %q", cur.AMIType, cur.RemoteAccessUserName)
}
default:
return fmt.Errorf("unknown ASGs[%q].AMIType %q", k, cur.AMIType)
}
Expand All @@ -417,6 +421,10 @@ func (cfg *Config) validateAddOnManagedNodeGroups() error {
if len(cur.InstanceTypes) == 0 {
cur.InstanceTypes = []string{DefaultNodeInstanceTypeGPU}
}
case eks.AMITypesAl2Arm64:
if len(cur.InstanceTypes) == 0 {
cur.InstanceTypes = []string{DefaultNodeInstanceTypeARMCPU}
}
default:
return fmt.Errorf("unknown AddOnManagedNodeGroups.MNGs[%q].AMIType %q", k, cur.AMIType)
}
Expand Down
2 changes: 2 additions & 0 deletions eksconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,8 @@ const (

// DefaultNodeInstanceTypeCPU is the default EC2 instance type for CPU worker node.
DefaultNodeInstanceTypeCPU = "c5.xlarge"
// DefaultNodeInstanceTypeARMCPU is the default EC2 instance type for ARM CPU worker node.
DefaultNodeInstanceTypeARMCPU = "c6g.xlarge"
// DefaultNodeInstanceTypeGPU is the default EC2 instance type for GPU worker node.
DefaultNodeInstanceTypeGPU = "p3.8xlarge"

Expand Down

0 comments on commit 26909f6

Please sign in to comment.