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
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ require (
github.com/aws/aws-sdk-go-v2 v1.36.3
github.com/aws/aws-sdk-go-v2/config v1.29.12
github.com/aws/aws-sdk-go-v2/credentials v1.17.65
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.52.2
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.59.1
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.52.3
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.59.2
github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.48.3
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.47.2
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.47.3
github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider v1.51.3
github.com/aws/aws-sdk-go-v2/service/ec2 v1.210.1
github.com/aws/aws-sdk-go-v2/service/eks v1.63.1
github.com/aws/aws-sdk-go-v2/service/eks v1.64.0
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.29.2
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.45.1
github.com/aws/aws-sdk-go-v2/service/iam v1.41.1
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,20 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 h1:bIqFDwgGXXN1Kpp99pDOdKMTTb5d
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3/go.mod h1:H5O/EsxDWyU+LP/V8i5sm8cxoZgc2fdNR9bxlOFrQTo=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.33 h1:/frG8aV09yhCVSOEC2pzktflJJO48NwY3xntHBwxHiA=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.33/go.mod h1:8vwASlAcV366M+qxZnjNzCjeastk1Rt1bpSRaGZanGU=
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.52.2 h1:OA5uEC/SrjRLhNGHgF/iS6YQz1bjlrCje9sERyLlGro=
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.52.2/go.mod h1:CDqMoc3KRdZJ8qziW96J35lKH01Wq3B2aihtHj2JbRs=
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.59.1 h1:VaXjN6szl50hbLMfSOKBKl3bEOb805aHe8j1yv0fKhU=
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.59.1/go.mod h1:penaZKzGmqHGZId4EUCBIW/f9l4Y7hQ5NKd45yoCYuI=
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.52.3 h1:QsKdBxtC8csnKt5BbV7D1op4Nf13p2YkTJIkppaCakw=
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.52.3/go.mod h1:CDqMoc3KRdZJ8qziW96J35lKH01Wq3B2aihtHj2JbRs=
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.59.2 h1:o9cuZdZlI9VWMqsNa2mnf2IRsFAROHnaYA1BW3lHGuY=
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.59.2/go.mod h1:penaZKzGmqHGZId4EUCBIW/f9l4Y7hQ5NKd45yoCYuI=
github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.48.3 h1:nTKHvvDTsS6SqAqu/fDhpmbNmDz+0ONh8niPoCkhPtM=
github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.48.3/go.mod h1:/BibEr5ksr34abqBTQN213GrNG6GCKCB6WG7CH4zH2w=
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.47.2 h1:caIDFGKezQQA/kali05x3NF2DVwzjtOFjvNvFnEeCm4=
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.47.2/go.mod h1:uo14VBn5cNk/BPGTPz3kyLBxgpgOObgO8lmz+H7Z4Ck=
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.47.3 h1:3y0jkGtsaZLCg+n73BoSXOAkLFtgmD/+4prXW1pzovc=
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.47.3/go.mod h1:uo14VBn5cNk/BPGTPz3kyLBxgpgOObgO8lmz+H7Z4Ck=
github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider v1.51.3 h1:4U9dpQZTvJ0Mi1qn8L1hRJ4igFCQYEjwUuOmYkWM5tE=
github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider v1.51.3/go.mod h1:ygltZT++6Wn2uG4+tqE0NW1MkdEtb5W2O/CFc0xJX/g=
github.com/aws/aws-sdk-go-v2/service/ec2 v1.210.1 h1:+4A9SDduLZFlDeXWRmfQ6r8kyEJZQfK6lcg+KwdvWrI=
github.com/aws/aws-sdk-go-v2/service/ec2 v1.210.1/go.mod h1:ouvGEfHbLaIlWwpDpOVWPWR+YwO0HDv3vm5tYLq8ImY=
github.com/aws/aws-sdk-go-v2/service/eks v1.63.1 h1:oI4AHf3K7cA+ukczcNwYsE8A7trMQiTRZTsgfkSS9BE=
github.com/aws/aws-sdk-go-v2/service/eks v1.63.1/go.mod h1:v1xXy6ea0PHtWkjFUvAUh6B/5wv7UF909Nru0dOIJDk=
github.com/aws/aws-sdk-go-v2/service/eks v1.64.0 h1:EYeOThTRysemFtC6J6h6b7dNg3jN03QuO5cg92ojIQE=
github.com/aws/aws-sdk-go-v2/service/eks v1.64.0/go.mod h1:v1xXy6ea0PHtWkjFUvAUh6B/5wv7UF909Nru0dOIJDk=
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.29.2 h1:Zlfmpg4QsduBeiK0vTc8WjnHZoYVGe64FcwuCsipjWE=
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.29.2/go.mod h1:H232HdqVlSUoqy0cMJYW1TKjcxvGFGFZ20xQG8fOAPw=
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.45.1 h1:USXR7nfl+bu7HnR/M3KtnPD3wjlCXM72kYX+2PaIgEI=
Expand Down
2 changes: 2 additions & 0 deletions pkg/ami/ssm_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ func MakeManagedSSMParameterName(version string, amiType ekstypes.AMITypes) stri
return fmt.Sprintf("/aws/service/eks/optimized-ami/%s/%s/x86_64/neuron/recommended/release_version", version, utils.ToKebabCase(api.NodeImageFamilyAmazonLinux2023))
case ekstypes.AMITypesAl2023Arm64Standard:
return fmt.Sprintf("/aws/service/eks/optimized-ami/%s/%s/arm64/standard/recommended/release_version", version, utils.ToKebabCase(api.NodeImageFamilyAmazonLinux2023))
case ekstypes.AMITypesAl2023Arm64Nvidia:
return fmt.Sprintf("/aws/service/eks/optimized-ami/%s/%s/arm64/nvidia/recommended/release_version", version, utils.ToKebabCase(api.NodeImageFamilyAmazonLinux2023))
case ekstypes.AMITypesAl2X8664:
return makeAL2ParameterName("")
case ekstypes.AMITypesAl2X8664Gpu:
Expand Down
2 changes: 0 additions & 2 deletions pkg/ami/ssm_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,6 @@ var _ = Describe("AMI Auto Resolution", func() {
var eksAMIType ekstypes.AMITypes
for _, amiType := range eksAMIType.Values() {
if amiType == ekstypes.AMITypesCustom || strings.HasPrefix(string(amiType), "WINDOWS_") ||
// TODO: remove this condition after adding support for AL2023 Nvidia and Neuron AMI types.
amiType == ekstypes.AMITypesAl2023X8664Nvidia || amiType == ekstypes.AMITypesAl2023X8664Neuron ||
// TODO: remove this condition after support for Bottlerocket FIPS AMI types.
amiType == ekstypes.AMITypesBottlerocketArm64Fips || amiType == ekstypes.AMITypesBottlerocketX8664Fips {
continue
Expand Down
91 changes: 91 additions & 0 deletions pkg/apis/eksctl.io/v1alpha5/amitype.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package v1alpha5

import (
ekstypes "github.com/aws/aws-sdk-go-v2/service/eks/types"
instanceutils "github.com/weaveworks/eksctl/pkg/utils/instance"
)

// GetAMIType returns the most appropriate amiType for the amiFamily and
// instanceType provided. Parameter `strict` controls whether or not fallbacks
// should be applied when searching for specialized amiTypes (eg. accerated
// instance types). If `strict` is false a fallback may be applied, otherwise a
// valid value is not guaranteed to be returned (empty string).
func GetAMIType(amiFamily, instanceType string, strict bool) ekstypes.AMITypes {
amiTypeMapping := map[string]struct {
X86x64 ekstypes.AMITypes
X86Nvidia ekstypes.AMITypes
X86Neuron ekstypes.AMITypes
ARM ekstypes.AMITypes
ARM64Nvidia ekstypes.AMITypes
ARM64Neuron ekstypes.AMITypes
}{
NodeImageFamilyAmazonLinux2023: {
X86x64: ekstypes.AMITypesAl2023X8664Standard,
X86Nvidia: ekstypes.AMITypesAl2023X8664Nvidia,
X86Neuron: ekstypes.AMITypesAl2023X8664Neuron,
ARM: ekstypes.AMITypesAl2023Arm64Standard,
ARM64Nvidia: ekstypes.AMITypesAl2023Arm64Nvidia,
},
NodeImageFamilyAmazonLinux2: {
X86x64: ekstypes.AMITypesAl2X8664,
X86Nvidia: ekstypes.AMITypesAl2X8664Gpu,
X86Neuron: ekstypes.AMITypesAl2X8664Gpu,
ARM: ekstypes.AMITypesAl2Arm64,
},
NodeImageFamilyBottlerocket: {
X86x64: ekstypes.AMITypesBottlerocketX8664,
X86Nvidia: ekstypes.AMITypesBottlerocketX8664Nvidia,
X86Neuron: ekstypes.AMITypesBottlerocketX8664,
ARM: ekstypes.AMITypesBottlerocketArm64,
ARM64Nvidia: ekstypes.AMITypesBottlerocketArm64Nvidia,
ARM64Neuron: ekstypes.AMITypesBottlerocketArm64,
},
NodeImageFamilyWindowsServer2019FullContainer: {
X86x64: ekstypes.AMITypesWindowsFull2019X8664,
X86Nvidia: ekstypes.AMITypesWindowsFull2019X8664,
},
NodeImageFamilyWindowsServer2019CoreContainer: {
X86x64: ekstypes.AMITypesWindowsCore2019X8664,
X86Nvidia: ekstypes.AMITypesWindowsCore2019X8664,
},
NodeImageFamilyWindowsServer2022FullContainer: {
X86x64: ekstypes.AMITypesWindowsFull2022X8664,
X86Nvidia: ekstypes.AMITypesWindowsFull2022X8664,
},
NodeImageFamilyWindowsServer2022CoreContainer: {
X86x64: ekstypes.AMITypesWindowsCore2022X8664,
X86Nvidia: ekstypes.AMITypesWindowsCore2022X8664,
},
}

amiType, ok := amiTypeMapping[amiFamily]
if !ok {
return ekstypes.AMITypesCustom
}

// this helper short circuits the check for missing entries for amiTypes in
// ami families based on the value of `strict`.
isValid := func(amiType ekstypes.AMITypes) bool {
return strict || amiType != ""
}

if instanceutils.IsARMInstanceType(instanceType) {
switch {
case instanceutils.IsNvidiaInstanceType(instanceType) && isValid(amiType.ARM64Nvidia):
return amiType.ARM64Nvidia
case instanceutils.IsNeuronInstanceType(instanceType) && isValid(amiType.ARM64Neuron):
return amiType.ARM64Neuron
default:
return amiType.ARM
}
} else {
switch {
case instanceutils.IsNvidiaInstanceType(instanceType) && isValid(amiType.X86Nvidia):
return amiType.X86Nvidia
case instanceutils.IsNeuronInstanceType(instanceType) && isValid(amiType.X86Neuron):
return amiType.X86Neuron
default:
return amiType.X86x64
}
}
}
5 changes: 2 additions & 3 deletions pkg/apis/eksctl.io/v1alpha5/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
ekstypes "github.com/aws/aws-sdk-go-v2/service/eks/types"

"github.com/weaveworks/eksctl/pkg/utils"
instanceutils "github.com/weaveworks/eksctl/pkg/utils/instance"
)

const (
Expand Down Expand Up @@ -149,8 +148,8 @@ func SetManagedNodeGroupDefaults(ng *ManagedNodeGroup, meta *ClusterMeta, contro
// When using custom AMIs, we want the user to explicitly specify AMI family.
// Thus, we only set up default AMI family when no custom AMI is being used.
if ng.AMIFamily == "" && ng.AMI == "" {
if isMinVer, _ := utils.IsMinVersion(Version1_30, meta.Version); isMinVer &&
!instanceutils.IsARMGPUInstanceType(ng.InstanceType) {
// AL2023 is the default ami type on EKS managed nodegroups after 1.30.
if isMinVer, _ := utils.IsMinVersion(Version1_30, meta.Version); isMinVer {
ng.AMIFamily = NodeImageFamilyAmazonLinux2023
} else {
ng.AMIFamily = NodeImageFamilyAmazonLinux2
Expand Down
20 changes: 11 additions & 9 deletions pkg/apis/eksctl.io/v1alpha5/gpu_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ var _ = Describe("GPU instance support", func() {
amiFamily: api.NodeImageFamilyAmazonLinux2023,
gpuInstanceType: "g4dn.xlarge",
}),
Entry("AL2023 ARM NVIDIA", gpuInstanceEntry{
amiFamily: api.NodeImageFamilyAmazonLinux2023,
gpuInstanceType: "g5g.2xlarge",
}),
Entry("AL2", gpuInstanceEntry{
gpuInstanceType: "asdf",
amiFamily: api.NodeImageFamilyAmazonLinux2,
Expand Down Expand Up @@ -96,7 +100,6 @@ var _ = Describe("GPU instance support", func() {
ng.InstanceType = e.gpuInstanceType
ng.AMIFamily = e.amiFamily
assertValidationError(e, api.ValidateNodeGroup(0, ng, api.NewClusterConfig()))

},
Entry("AL2023 INF", gpuInstanceEntry{
amiFamily: api.NodeImageFamilyAmazonLinux2023,
Expand All @@ -110,6 +113,10 @@ var _ = Describe("GPU instance support", func() {
amiFamily: api.NodeImageFamilyAmazonLinux2023,
gpuInstanceType: "g4dn.xlarge",
}),
Entry("AL2023 ARM NVIDIA", gpuInstanceEntry{
amiFamily: api.NodeImageFamilyAmazonLinux2023,
gpuInstanceType: "g5g.2xlarge",
}),
Entry("AL2", gpuInstanceEntry{
gpuInstanceType: "g4dn.xlarge",
amiFamily: api.NodeImageFamilyAmazonLinux2,
Expand Down Expand Up @@ -244,16 +251,11 @@ var _ = Describe("GPU instance support", func() {
amiFamily := api.NodeImageFamilyAmazonLinux2023
instanceType := "g5g.2xlarge"

ngFail := api.NewNodeGroup()
ngFail.AMIFamily = amiFamily
ngFail.InstanceType = instanceType

ngPass := api.NewNodeGroup()
ngPass.AMIFamily = amiFamily
ngPass.InstanceType = instanceType
ngPass.AMI = "ami-xxxx"

Expect(api.ValidateNodeGroup(0, ngFail, api.NewClusterConfig())).To(HaveOccurred())
Expect(api.ValidateNodeGroup(0, ngPass, api.NewClusterConfig())).NotTo(HaveOccurred())
})

Expand All @@ -263,14 +265,14 @@ var _ = Describe("GPU instance support", func() {
ng.AMIFamily = amiFamily
err := api.ValidateNodeGroup(0, ng, api.NewClusterConfig())
if expectErr {
Expect(err).To(MatchError(fmt.Sprintf("ARM GPU instance types are not supported for unmanaged nodegroups with AMIFamily %s", amiFamily)))
Expect(err).To(MatchError(fmt.Sprintf("%s instance types are not supported for unmanaged nodegroups with AMIFamily %s", ng.InstanceType, amiFamily)))
} else {
Expect(err).NotTo(HaveOccurred())
}
},
Entry("AmazonLinux2", api.NodeImageFamilyAmazonLinux2, true),
Entry("AmazonLinux2023", api.NodeImageFamilyAmazonLinux2023, true),
Entry("Ubuntu2004", api.NodeImageFamilyUbuntu2004, true),
Entry("AmazonLinux2023", api.NodeImageFamilyAmazonLinux2023, false),
Entry("Ubuntu2004", api.NodeImageFamilyUbuntu2004, false),
Entry("Windows2019Full", api.NodeImageFamilyWindowsServer2019FullContainer, true),
Entry("Windows2019Core", api.NodeImageFamilyWindowsServer2019CoreContainer, true),
Entry("Bottlerocket", api.NodeImageFamilyBottlerocket, false),
Expand Down
10 changes: 4 additions & 6 deletions pkg/apis/eksctl.io/v1alpha5/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -1079,12 +1079,10 @@ func validateInstanceTypeSupport(ng *NodeGroup) error {
if IsAMI(ng.AMI) {
return nil
}
if instanceutils.IsARMGPUInstanceType(SelectInstanceType(ng)) {
switch ng.AMIFamily {
case NodeImageFamilyBottlerocket:
default:
return fmt.Errorf("ARM GPU instance types are not supported for unmanaged nodegroups with AMIFamily %s", ng.AMIFamily)
}
instanceType := SelectInstanceType(ng)
amiType := GetAMIType(ng.AMIFamily, instanceType, true /* strict, don't allows fallbacks */)
if amiType == "" {
return fmt.Errorf("%s instance types are not supported for unmanaged nodegroups with AMIFamily %s", instanceType, ng.AMIFamily)
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/eksctl.io/v1alpha5/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1796,15 +1796,15 @@ var _ = Describe("ClusterConfig validation", func() {
ng.InstancesDistribution.InstanceTypes = []string{"g5g.2xlarge"}
ng.AMIFamily = api.NodeImageFamilyAmazonLinux2
err := api.ValidateNodeGroup(0, ng, cfg)
Expect(err).To(MatchError("ARM GPU instance types are not supported for unmanaged nodegroups with AMIFamily AmazonLinux2"))
Expect(err).To(MatchError("g5g.2xlarge instance types are not supported for unmanaged nodegroups with AMIFamily AmazonLinux2"))
})

It("ARM-based GPU instance type fails for AmazonLinux2", func() {
ng.InstanceType = "g5g.2xlarge"
ng.InstancesDistribution.InstanceTypes = nil
ng.AMIFamily = api.NodeImageFamilyAmazonLinux2
err := api.ValidateNodeGroup(0, ng, cfg)
Expect(err).To(MatchError("ARM GPU instance types are not supported for unmanaged nodegroups with AMIFamily AmazonLinux2"))
Expect(err).To(MatchError("g5g.2xlarge instance types are not supported for unmanaged nodegroups with AMIFamily AmazonLinux2"))
})

It("fails when instance distribution is enabled and instanceType set", func() {
Expand Down
68 changes: 2 additions & 66 deletions pkg/cfn/builder/managed_nodegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (m *ManagedNodeGroupResourceSet) AddAllResources(ctx context.Context) error
instanceTypes := m.nodeGroup.InstanceTypeList()

makeAMIType := func() *gfnt.Value {
return gfnt.NewString(string(getAMIType(m.nodeGroup, selectManagedInstanceType(m.nodeGroup))))
return gfnt.NewString(string(api.GetAMIType(m.nodeGroup.AMIFamily, selectManagedInstanceType(m.nodeGroup), false /* not strict, allow fallback */)))
}

var launchTemplate *gfneks.Nodegroup_LaunchTemplateSpecification
Expand All @@ -178,7 +178,7 @@ func (m *ManagedNodeGroupResourceSet) AddAllResources(ctx context.Context) error
if launchTemplateData.InstanceType == "" {
managedResource.AmiType = makeAMIType()
} else {
managedResource.AmiType = gfnt.NewString(string(getAMIType(m.nodeGroup, string(launchTemplateData.InstanceType))))
managedResource.AmiType = gfnt.NewString(string(api.GetAMIType(m.nodeGroup.AMIFamily, string(launchTemplateData.InstanceType), false /* not strict, allow fallback */)))
}
}

Expand Down Expand Up @@ -305,70 +305,6 @@ func validateLaunchTemplate(launchTemplateData *ec2types.ResponseLaunchTemplateD
return nil
}

func getAMIType(ng *api.ManagedNodeGroup, instanceType string) ekstypes.AMITypes {
amiTypeMapping := map[string]struct {
X86x64 ekstypes.AMITypes
X86Nvidia ekstypes.AMITypes
X86Neuron ekstypes.AMITypes
ARM ekstypes.AMITypes
ARMGPU ekstypes.AMITypes
}{
api.NodeImageFamilyAmazonLinux2023: {
X86x64: ekstypes.AMITypesAl2023X8664Standard,
X86Nvidia: ekstypes.AMITypesAl2023X8664Nvidia,
X86Neuron: ekstypes.AMITypesAl2023X8664Neuron,
ARM: ekstypes.AMITypesAl2023Arm64Standard,
},
api.NodeImageFamilyAmazonLinux2: {
X86x64: ekstypes.AMITypesAl2X8664,
X86Nvidia: ekstypes.AMITypesAl2X8664Gpu,
X86Neuron: ekstypes.AMITypesAl2X8664Gpu,
ARM: ekstypes.AMITypesAl2Arm64,
},
api.NodeImageFamilyBottlerocket: {
X86x64: ekstypes.AMITypesBottlerocketX8664,
X86Nvidia: ekstypes.AMITypesBottlerocketX8664Nvidia,
X86Neuron: ekstypes.AMITypesBottlerocketX8664,
ARM: ekstypes.AMITypesBottlerocketArm64,
ARMGPU: ekstypes.AMITypesBottlerocketArm64Nvidia,
},
api.NodeImageFamilyWindowsServer2019FullContainer: {
X86x64: ekstypes.AMITypesWindowsFull2019X8664,
X86Nvidia: ekstypes.AMITypesWindowsFull2019X8664,
},
api.NodeImageFamilyWindowsServer2019CoreContainer: {
X86x64: ekstypes.AMITypesWindowsCore2019X8664,
X86Nvidia: ekstypes.AMITypesWindowsCore2019X8664,
},
api.NodeImageFamilyWindowsServer2022FullContainer: {
X86x64: ekstypes.AMITypesWindowsFull2022X8664,
X86Nvidia: ekstypes.AMITypesWindowsFull2022X8664,
},
api.NodeImageFamilyWindowsServer2022CoreContainer: {
X86x64: ekstypes.AMITypesWindowsCore2022X8664,
X86Nvidia: ekstypes.AMITypesWindowsCore2022X8664,
},
}

amiType, ok := amiTypeMapping[ng.AMIFamily]
if !ok {
return ekstypes.AMITypesCustom
}

switch {
case instanceutils.IsARMGPUInstanceType(instanceType):
return amiType.ARMGPU
case instanceutils.IsARMInstanceType(instanceType):
return amiType.ARM
case instanceutils.IsNvidiaInstanceType(instanceType):
return amiType.X86Nvidia
case instanceutils.IsNeuronInstanceType(instanceType):
return amiType.X86Neuron
default:
return amiType.X86x64
}
}

// RenderJSON implements the ResourceSet interface
func (m *ManagedNodeGroupResourceSet) RenderJSON() ([]byte, error) {
return m.resourceSet.renderJSON()
Expand Down
6 changes: 0 additions & 6 deletions pkg/utils/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ func IsNeuronInstanceType(instanceType string) bool {
return InstanceTypesMap[instanceType].NeuronSupported
}

// IsARMGPUInstanceType returns true if the instance type is ARM-GPU architecture
func IsARMGPUInstanceType(instanceType string) bool {
itype := InstanceTypesMap[instanceType]
return itype.CPUArch == "arm64" && itype.NvidiaGPUSupported
}

// IsNvidiaInstanceType returns true if the instance type has NVIDIA accelerated hardware
func IsNvidiaInstanceType(instanceType string) bool {
return InstanceTypesMap[instanceType].NvidiaGPUSupported
Expand Down
Loading