Skip to content

Commit

Permalink
Bugfix: instances listed under maxVolumeLimits not taking into accoun…
Browse files Browse the repository at this point in the history
…t ENIs/Instance storage

Signed-off-by: Eddie Torres <[email protected]>
  • Loading branch information
torredil committed Dec 11, 2023
1 parent 1aa09de commit 61905a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 4 additions & 6 deletions pkg/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,10 @@ func (d *nodeService) getVolumesLimit() int64 {
availableAttachments := cloud.GetMaxAttachments(isNitro)
blockVolumes := d.metadata.GetNumBlockDeviceMappings()
dedicatedLimit := cloud.GetDedicatedLimitForInstanceType(instanceType)

maxEBSAttachments, ok := cloud.GetEBSLimitForInstanceType(instanceType)
if ok {
availableAttachments = min(maxEBSAttachments, availableAttachments)
}
// For special dedicated limit instance types, the limit is only for EBS volumes
// For (all other) Nitro instances, attachments are shared between EBS volumes, ENIs and NVMe instance stores
if dedicatedLimit != 0 {
Expand All @@ -794,11 +797,6 @@ func (d *nodeService) getVolumesLimit() int64 {
availableAttachments = 1
}

maxEBSAttachments, ok := cloud.GetEBSLimitForInstanceType(instanceType)
if ok {
availableAttachments = min(maxEBSAttachments, availableAttachments)
}

return int64(availableAttachments)
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/driver/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2112,7 +2112,7 @@ func TestNodeGetInfo(t *testing.T) {
region: "us-west-2",
volumeAttachLimit: -1,
attachedENIs: 1,
expMaxVolumes: 19,
expMaxVolumes: 17,
outpostArn: emptyOutpostArn,
},
{
Expand All @@ -2123,7 +2123,7 @@ func TestNodeGetInfo(t *testing.T) {
region: "us-west-2",
volumeAttachLimit: -1,
attachedENIs: 1,
expMaxVolumes: 16,
expMaxVolumes: 14,
outpostArn: emptyOutpostArn,
},
{
Expand All @@ -2134,7 +2134,7 @@ func TestNodeGetInfo(t *testing.T) {
region: "us-west-2",
volumeAttachLimit: -1,
attachedENIs: 1,
expMaxVolumes: 11,
expMaxVolumes: 9,
outpostArn: emptyOutpostArn,
},
{
Expand Down

0 comments on commit 61905a1

Please sign in to comment.