From cb01c0346687a7d6dc6857bf99c95b1f29d3d9a7 Mon Sep 17 00:00:00 2001 From: elijah quinones Date: Wed, 14 Aug 2024 20:10:07 +0000 Subject: [PATCH] Fix node.go eni calculation for maxVolumeLimits table instances fix typos refactor table generation scripts --- hack/generate-gpu-count-table.sh | 2 +- hack/generate-instance-store-table.sh | 2 +- pkg/cloud/volume_limits.go | 4 ++-- pkg/driver/node.go | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hack/generate-gpu-count-table.sh b/hack/generate-gpu-count-table.sh index a401f3b47..ada376213 100755 --- a/hack/generate-gpu-count-table.sh +++ b/hack/generate-gpu-count-table.sh @@ -35,4 +35,4 @@ function get_all_gpus() { done } -get_all_gpus | sort | uniq | grep -vE "(g5.48xlarge)" +get_all_gpus | sort | uniq | grep -v "g5.48xlarge" diff --git a/hack/generate-instance-store-table.sh b/hack/generate-instance-store-table.sh index ce5497395..471085e7e 100755 --- a/hack/generate-instance-store-table.sh +++ b/hack/generate-instance-store-table.sh @@ -37,4 +37,4 @@ function get_all_instance_stores() { done } -get_all_instance_stores | sort | uniq | grep -vE "(g5.48xlarge)" +get_all_instance_stores | sort | uniq | grep -v "g5.48xlarge" diff --git a/pkg/cloud/volume_limits.go b/pkg/cloud/volume_limits.go index 2eb9c7c3c..78adde15f 100644 --- a/pkg/cloud/volume_limits.go +++ b/pkg/cloud/volume_limits.go @@ -558,8 +558,8 @@ var gpuInstanceGpus = map[string]int{ } // / Note this table is not a reflection of how many accelerators an instance has but of how many slots their combined acclerators take up -// / VT instance type accelerators take two slots each with the excpetion of the vt1.24xlarge which takes 0 slots for it's acclerators -// / inf1 instance types are purposley not added to this table as they are in the maxVolumeLimits table +// / VT instance type accelerators take two slots each with the exception of the vt1.24xlarge which takes 0 slots for its acclerators +// / inf1 instance types are purposely not added to this table as they are in the maxVolumeLimits table var acceleratorSlotsTaken = map[string]int{ "vt1.3xlarge": 2, "vt1.6xlarge": 4, diff --git a/pkg/driver/node.go b/pkg/driver/node.go index 384fc8737..69c65aa60 100644 --- a/pkg/driver/node.go +++ b/pkg/driver/node.go @@ -781,8 +781,8 @@ func (d *NodeService) getVolumesLimit() int64 { } dedicatedLimit := cloud.GetDedicatedLimitForInstanceType(instanceType) - maxEBSAttachments, hasMaxvolumeLimit := cloud.GetEBSLimitForInstanceType(instanceType) - if hasMaxvolumeLimit { + maxEBSAttachments, hasMaxVolumeLimit := cloud.GetEBSLimitForInstanceType(instanceType) + if hasMaxVolumeLimit { availableAttachments = min(maxEBSAttachments, availableAttachments) } // For special dedicated limit instance types, the limit is only for EBS volumes @@ -792,8 +792,8 @@ func (d *NodeService) getVolumesLimit() int64 { } else if isNitro { enis := d.metadata.GetNumAttachedENIs() reservedSlots := cloud.GetReservedSlotsForInstanceType(instanceType) - if hasMaxvolumeLimit { - availableAttachments = availableAttachments - reservedSlots + if hasMaxVolumeLimit { + availableAttachments = availableAttachments - (enis - 1) - reservedSlots } else { availableAttachments = availableAttachments - enis - reservedSlots }