Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Instances listed under maxVolumeLimits not taking into account ENIs/Instance storage #1860

Merged
merged 2 commits into from
Dec 14, 2023
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
2 changes: 1 addition & 1 deletion pkg/cloud/volume_limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func GetMaxAttachments(nitro bool) int {
// / https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_limits.html
var maxVolumeLimits = map[string]int{
"d3.8xlarge": 3,
"d3.12xlarge": 3,
"d3en.12xlarge": 3,
"g5.48xlarge": 9,
"inf1.xlarge": 26,
"inf1.2xlarge": 26,
Expand Down
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
28 changes: 25 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 Expand Up @@ -2196,6 +2196,28 @@ func TestNodeGetInfo(t *testing.T) {
expMaxVolumes: 127, // 128 (max) - 1 (root)
outpostArn: emptyOutpostArn,
},
{
name: "d3.8xlarge instance max EBS attachment limit",
instanceID: "i-123456789abcdef01",
instanceType: "d3.8xlarge",
availabilityZone: "us-west-2b",
region: "us-west-2",
volumeAttachLimit: -1,
attachedENIs: 1,
expMaxVolumes: 1,
outpostArn: emptyOutpostArn,
},
{
name: "d3en.12xlarge instance max EBS attachment limit",
instanceID: "i-123456789abcdef01",
instanceType: "d3en.12xlarge",
availabilityZone: "us-west-2b",
region: "us-west-2",
volumeAttachLimit: -1,
attachedENIs: 1,
expMaxVolumes: 1,
outpostArn: emptyOutpostArn,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
Expand Down
Loading