diff --git a/pkg/providers/instancetype/nodeclass_test.go b/pkg/providers/instancetype/nodeclass_test.go index 16cb06e0f502..bee4807860ea 100644 --- a/pkg/providers/instancetype/nodeclass_test.go +++ b/pkg/providers/instancetype/nodeclass_test.go @@ -428,20 +428,6 @@ var _ = Describe("NodeClass/InstanceTypes", func() { ExpectProvisioned(ctx, env.Client, cluster, cloudProvider, prov, pod) ExpectScheduled(ctx, env.Client, pod) }) - It("should fail to launch AWS Pod ENI if the setting enabling it isn't set", func() { - ctx = settings.ToContext(ctx, test.Settings(test.SettingOptions{ - EnablePodENI: lo.ToPtr(false), - })) - ExpectApplied(ctx, env.Client, nodePool, nodeClass) - pod := coretest.UnschedulablePod(coretest.PodOptions{ - ResourceRequirements: v1.ResourceRequirements{ - Requests: v1.ResourceList{v1beta1.ResourceAWSPodENI: resource.MustParse("1")}, - Limits: v1.ResourceList{v1beta1.ResourceAWSPodENI: resource.MustParse("1")}, - }, - }) - ExpectProvisioned(ctx, env.Client, cluster, cloudProvider, prov, pod) - ExpectNotScheduled(ctx, env.Client, pod) - }) It("should launch AWS Pod ENI on a compatible instance type", func() { ExpectApplied(ctx, env.Client, nodePool, nodeClass) pod := coretest.UnschedulablePod(coretest.PodOptions{ @@ -928,10 +914,6 @@ var _ = Describe("NodeClass/InstanceTypes", func() { } }) It("should override max-pods value when AWSENILimitedPodDensity is unset", func() { - ctx = settings.ToContext(ctx, test.Settings(test.SettingOptions{ - EnablePodENI: lo.ToPtr(false), - })) - instanceInfo, err := awsEnv.InstanceTypesProvider.GetInstanceTypes(ctx) Expect(err).To(BeNil()) nodePool.Spec.Template.Spec.Kubelet = &corev1beta1.KubeletConfiguration{ diff --git a/pkg/providers/instancetype/nodetemplate_test.go b/pkg/providers/instancetype/nodetemplate_test.go index 30e03bdfa179..890e4d387f17 100644 --- a/pkg/providers/instancetype/nodetemplate_test.go +++ b/pkg/providers/instancetype/nodetemplate_test.go @@ -435,20 +435,6 @@ var _ = Describe("NodeTemplate/InstanceTypes", func() { ExpectProvisioned(ctx, env.Client, cluster, cloudProvider, prov, pod) ExpectScheduled(ctx, env.Client, pod) }) - It("should fail to launch AWS Pod ENI if the setting enabling it isn't set", func() { - ctx = settings.ToContext(ctx, test.Settings(test.SettingOptions{ - EnablePodENI: lo.ToPtr(false), - })) - ExpectApplied(ctx, env.Client, provisioner, nodeTemplate) - pod := coretest.UnschedulablePod(coretest.PodOptions{ - ResourceRequirements: v1.ResourceRequirements{ - Requests: v1.ResourceList{v1alpha1.ResourceAWSPodENI: resource.MustParse("1")}, - Limits: v1.ResourceList{v1alpha1.ResourceAWSPodENI: resource.MustParse("1")}, - }, - }) - ExpectProvisioned(ctx, env.Client, cluster, cloudProvider, prov, pod) - ExpectNotScheduled(ctx, env.Client, pod) - }) It("should launch AWS Pod ENI on a compatible instance type", func() { ExpectApplied(ctx, env.Client, provisioner, nodeTemplate) pod := coretest.UnschedulablePod(coretest.PodOptions{ @@ -970,10 +956,6 @@ var _ = Describe("NodeTemplate/InstanceTypes", func() { } }) It("should override max-pods value when AWSENILimitedPodDensity is unset", func() { - ctx = settings.ToContext(ctx, test.Settings(test.SettingOptions{ - EnablePodENI: lo.ToPtr(false), - })) - instanceInfo, err := awsEnv.InstanceTypesProvider.GetInstanceTypes(ctx) Expect(err).To(BeNil()) provisioner = test.Provisioner(coretest.ProvisionerOptions{Kubelet: &v1alpha5.KubeletConfiguration{MaxPods: ptr.Int32(10)}}) diff --git a/pkg/providers/instancetype/types.go b/pkg/providers/instancetype/types.go index 5f132f1c6cb3..750543c3e251 100644 --- a/pkg/providers/instancetype/types.go +++ b/pkg/providers/instancetype/types.go @@ -173,19 +173,16 @@ func computeCapacity(ctx context.Context, info *ec2.InstanceTypeInfo, amiFamily blockDeviceMappings []*v1beta1.BlockDeviceMapping, kc *corev1beta1.KubeletConfiguration) v1.ResourceList { resourceList := v1.ResourceList{ - v1.ResourceCPU: *cpu(info), - v1.ResourceMemory: *memory(ctx, info), - v1.ResourceEphemeralStorage: *ephemeralStorage(amiFamily, blockDeviceMappings), - v1.ResourcePods: *pods(ctx, info, amiFamily, kc), - v1beta1.ResourceAWSPodENI: *awsPodENI(ctx, aws.StringValue(info.InstanceType)), - v1beta1.ResourceNVIDIAGPU: *nvidiaGPUs(info), - v1beta1.ResourceAMDGPU: *amdGPUs(info), - v1beta1.ResourceAWSNeuron: *awsNeurons(info), - v1beta1.ResourceHabanaGaudi: *habanaGaudis(info), - } - if _, ok := amiFamily.(*amifamily.Windows); ok { - //ResourcePrivateIPv4Address is the same as ENILimitedPods on Windows node - resourceList[v1beta1.ResourcePrivateIPv4Address] = *privateIPv4Address(info) + v1.ResourceCPU: *cpu(info), + v1.ResourceMemory: *memory(ctx, info), + v1.ResourceEphemeralStorage: *ephemeralStorage(amiFamily, blockDeviceMappings), + v1.ResourcePods: *pods(ctx, info, amiFamily, kc), + v1beta1.ResourceAWSPodENI: *awsPodENI(aws.StringValue(info.InstanceType)), + v1beta1.ResourceNVIDIAGPU: *nvidiaGPUs(info), + v1beta1.ResourceAMDGPU: *amdGPUs(info), + v1beta1.ResourceAWSNeuron: *awsNeurons(info), + v1beta1.ResourceHabanaGaudi: *habanaGaudis(info), + v1beta1.ResourcePrivateIPv4Address: *privateIPv4Address(info), } return resourceList } @@ -238,10 +235,10 @@ func ephemeralStorage(amiFamily amifamily.AMIFamily, blockDeviceMappings []*v1be return amifamily.DefaultEBS.VolumeSize } -func awsPodENI(ctx context.Context, name string) *resource.Quantity { +func awsPodENI(name string) *resource.Quantity { // https://docs.aws.amazon.com/eks/latest/userguide/security-groups-for-pods.html#supported-instance-types limits, ok := Limits[name] - if settings.FromContext(ctx).EnablePodENI && ok && limits.IsTrunkingCompatible { + if ok && limits.IsTrunkingCompatible { return resources.Quantity(fmt.Sprint(limits.BranchInterface)) } return resources.Quantity("0")