Skip to content

Commit

Permalink
Increased the AccessPoint MAX limit from 120 to 1000
Browse files Browse the repository at this point in the history
  • Loading branch information
seanzatzdev-amazon committed Sep 15, 2023
1 parent b00bf67 commit 3f36f09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
13 changes: 6 additions & 7 deletions pkg/driver/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func TestCreateVolume(t *testing.T) {
DirectoryPerms: "777",
BasePath: "test",
GidMin: "1000",
GidMax: "1200",
GidMax: "2000",
},
}

Expand All @@ -428,7 +428,7 @@ func TestCreateVolume(t *testing.T) {
}

accessPoints := []*cloud.AccessPoint{}
for i := 0; i < 119; i++ {
for i := 0; i < ACCESS_POINT_PER_FS_LIMIT-1; i++ {
gidMax, err := strconv.Atoi(req.Parameters[GidMax])
if err != nil {
t.Fatalf("Failed to convert GidMax Parameter to int.")
Expand All @@ -449,12 +449,12 @@ func TestCreateVolume(t *testing.T) {
AccessPointId: apId,
FileSystemId: fsId,
PosixUser: &cloud.PosixUser{
Gid: 1081,
Uid: 1081,
Gid: 1001,
Uid: 1001,
},
}

expectedGid := 1081
expectedGid := 1001
mockCloud.EXPECT().DescribeFileSystem(gomock.Eq(ctx), gomock.Any()).Return(fileSystem, nil)
mockCloud.EXPECT().ListAccessPoints(gomock.Eq(ctx), gomock.Any()).Return(accessPoints, nil)
mockCloud.EXPECT().CreateAccessPoint(gomock.Eq(ctx), gomock.Any(), gomock.Any()).Return(lastAccessPoint, nil).
Expand All @@ -478,9 +478,8 @@ func TestCreateVolume(t *testing.T) {
accessPoints = append(accessPoints, lastAccessPoint)
mockCloud.EXPECT().DescribeFileSystem(gomock.Eq(ctx), gomock.Any()).Return(fileSystem, nil)
mockCloud.EXPECT().ListAccessPoints(gomock.Eq(ctx), gomock.Any()).Return(accessPoints, nil)
mockCloud.EXPECT().CreateAccessPoint(gomock.Eq(ctx), gomock.Any(), gomock.Any()).Return(lastAccessPoint, nil).AnyTimes()

// All 120 GIDs are taken now, internal limit should take effect causing CreateVolume to fail.
// All 1000 GIDs are taken now, internal limit should take effect causing CreateVolume to fail.
_, err = driver.CreateVolume(ctx, req)
if err == nil {
t.Fatalf("CreateVolume should have failed.")
Expand Down
5 changes: 3 additions & 2 deletions pkg/driver/gid_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ package driver
import (
"context"
"fmt"
"sync"

"github.com/kubernetes-sigs/aws-efs-csi-driver/pkg/cloud"
"golang.org/x/exp/slices"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/klog/v2"
"sync"
)

var ACCESS_POINT_PER_FS_LIMIT int = 120
var ACCESS_POINT_PER_FS_LIMIT int = 1000

type FilesystemID struct {
gidMin int
Expand Down

0 comments on commit 3f36f09

Please sign in to comment.