Skip to content

Commit a3e62b7

Browse files
authored
Merge pull request #2749 from ConnorJC3/fix-volume-limits
Fix off-by-one error in volume limits for default nitro instances
2 parents fcc1c11 + 88e8050 commit a3e62b7

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

pkg/cloud/volume_limits.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ func GetVolumeLimits(instanceType string) (int, string) {
5050
return limit.maxAttachments, limit.attachmentType
5151
}
5252

53-
// Default to shared limit of 28
54-
return 28, util.AttachmentShared
53+
// Default to shared limit of 27
54+
return 27, util.AttachmentShared
5555
}
5656

5757
// KnownInstanceTypes returns all known instance types from the limits table.

pkg/driver/node_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,21 @@ func TestGetVolumesLimit(t *testing.T) {
10731073
return m
10741074
},
10751075
},
1076+
{
1077+
name: "m5.large_volume_attach_limit",
1078+
options: &Options{
1079+
VolumeAttachLimit: -1,
1080+
ReservedVolumeAttachments: -1,
1081+
},
1082+
expectedVal: 27,
1083+
metadataMock: func(ctrl *gomock.Controller) *metadata.MockMetadataService {
1084+
m := metadata.NewMockMetadataService(ctrl)
1085+
m.EXPECT().GetNumBlockDeviceMappings().Return(0)
1086+
m.EXPECT().GetInstanceType().Return("m5.large")
1087+
m.EXPECT().GetNumAttachedENIs().Return(0)
1088+
return m
1089+
},
1090+
},
10761091
{
10771092
name: "ReservedVolumeAttachments_specified",
10781093
options: &Options{

tests/e2e/metadata-labeler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ var _ = framework.Describe("[ebs-csi-e2e] [Disruptive] Metadata Labeler Sidecar"
171171

172172
// getAllocatableCount returns the limit of volumes that the node supports.
173173
func getAllocatableCount(volumes, enis int) int32 {
174-
return int32(28 - volumes - enis)
174+
return int32(27 - volumes - enis)
175175
}
176176

177177
// getVolENIs gets the expected metadata of each instance from the ec2 API

0 commit comments

Comments
 (0)