Skip to content

Commit

Permalink
chore: remove EnablePodENI logic (#4867)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdeal authored Oct 20, 2023
1 parent 6888966 commit be01fe5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 51 deletions.
18 changes: 0 additions & 18 deletions pkg/providers/instancetype/nodeclass_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down
18 changes: 0 additions & 18 deletions pkg/providers/instancetype/nodetemplate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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)}})
Expand Down
27 changes: 12 additions & 15 deletions pkg/providers/instancetype/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit be01fe5

Please sign in to comment.