Skip to content

Commit 58c76c8

Browse files
committed
feat: provide nfsv3 protocol to enforce nfs mount
add supported list
1 parent a33e816 commit 58c76c8

File tree

5 files changed

+39
-7
lines changed

5 files changed

+39
-7
lines changed

pkg/blob/blob.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ const (
112112
Fuse2 = "fuse2"
113113
NFS = "nfs"
114114
AZNFS = "aznfs"
115+
NFSv3 = "nfsv3"
115116
vnetResourceGroupField = "vnetresourcegroup"
116117
vnetNameField = "vnetname"
117118
subnetNameField = "subnetname"
@@ -155,7 +156,7 @@ const (
155156
)
156157

157158
var (
158-
supportedProtocolList = []string{Fuse, Fuse2, NFS}
159+
supportedProtocolList = []string{Fuse, Fuse2, NFS, AZNFS}
159160
retriableErrors = []string{accountNotProvisioned, tooManyRequests, statusCodeNotFound, containerBeingDeletedDataplaneAPIError, containerBeingDeletedManagementAPIError, clientThrottled}
160161
supportedFSGroupChangePolicyList = []string{FSGroupChangeNone, string(v1.FSGroupChangeAlways), string(v1.FSGroupChangeOnRootMismatch)}
161162
)
@@ -762,7 +763,7 @@ func isSupportedProtocol(protocol string) bool {
762763
return true
763764
}
764765
for _, v := range supportedProtocolList {
765-
if protocol == v {
766+
if protocol == v || protocol == NFSv3 {
766767
return true
767768
}
768769
}
@@ -804,7 +805,7 @@ func isSupportedContainerNamePrefix(prefix string) bool {
804805
// isNFSProtocol checks if the protocol is NFS or AZNFS
805806
func isNFSProtocol(protocol string) bool {
806807
protocol = strings.ToLower(protocol)
807-
return protocol == NFS || protocol == AZNFS
808+
return protocol == NFS || protocol == AZNFS || protocol == NFSv3
808809
}
809810

810811
// get storage account from secrets map

pkg/blob/blob_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,8 +1745,8 @@ func TestIsNFSProtocol(t *testing.T) {
17451745
expectedResult: true,
17461746
},
17471747
{
1748-
protocol: "NFSv3",
1749-
expectedResult: false,
1748+
protocol: "nfsv3",
1749+
expectedResult: true,
17501750
},
17511751
{
17521752
protocol: "aznfs",

pkg/blob/controllerserver_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func TestCreateVolume(t *testing.T) {
176176
controllerServiceCapability,
177177
}
178178
_, err := d.CreateVolume(context.Background(), req)
179-
expectedErr := status.Errorf(codes.InvalidArgument, "protocol(unit-test) is not supported, supported protocol list: [fuse fuse2 nfs]")
179+
expectedErr := status.Errorf(codes.InvalidArgument, "protocol(unit-test) is not supported, supported protocol list: [fuse fuse2 nfs aznfs]")
180180
if !reflect.DeepEqual(err, expectedErr) {
181181
t.Errorf("actualErr: (%v), expectedErr: (%v)", err, expectedErr)
182182
}

pkg/blob/nodeserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
346346
targetPath, protocol, volumeID, attrib, mountFlags, serverAddress)
347347

348348
mountType := AZNFS
349-
if !d.enableAznfsMount {
349+
if !d.enableAznfsMount || protocol == NFSv3 {
350350
mountType = NFS
351351
}
352352

test/e2e/dynamic_provisioning_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,37 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
529529
test.Run(ctx, cs, ns)
530530
})
531531

532+
ginkgo.It("enforce with nfs mount [nfs]", func(ctx ginkgo.SpecContext) {
533+
if isAzureStackCloud {
534+
ginkgo.Skip("test case is not available for Azure Stack")
535+
}
536+
pods := []testsuites.PodDetails{
537+
{
538+
Cmd: "echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data",
539+
Volumes: []testsuites.VolumeDetails{
540+
{
541+
ClaimSize: "10Gi",
542+
MountOptions: []string{
543+
"nconnect=8",
544+
},
545+
VolumeMount: testsuites.VolumeMountDetails{
546+
NameGenerate: "test-volume-",
547+
MountPathGenerate: "/mnt/test-",
548+
},
549+
},
550+
},
551+
},
552+
}
553+
test := testsuites.DynamicallyProvisionedCmdVolumeTest{
554+
CSIDriver: testDriver,
555+
Pods: pods,
556+
StorageClassParameters: map[string]string{
557+
"protocol": "nfsv3",
558+
},
559+
}
560+
test.Run(ctx, cs, ns)
561+
})
562+
532563
ginkgo.It("should create a NFSv3 volume on demand with zero mountPermissions [nfs]", func(ctx ginkgo.SpecContext) {
533564
if isAzureStackCloud {
534565
ginkgo.Skip("test case is not available for Azure Stack")

0 commit comments

Comments
 (0)