diff --git a/pkg/driver/controller_test.go b/pkg/driver/controller_test.go index 9cd7f8af8..7d93ae990 100644 --- a/pkg/driver/controller_test.go +++ b/pkg/driver/controller_test.go @@ -418,7 +418,7 @@ func TestCreateVolume(t *testing.T) { DirectoryPerms: "777", BasePath: "test", GidMin: "1000", - GidMax: "1200", + GidMax: "2000", }, } @@ -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.") @@ -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). @@ -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.") diff --git a/pkg/driver/gid_allocator.go b/pkg/driver/gid_allocator.go index f7d5063e7..e45f0b687 100644 --- a/pkg/driver/gid_allocator.go +++ b/pkg/driver/gid_allocator.go @@ -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