Skip to content

Commit b9ae1e9

Browse files
committed
feat: provide nfsv3 protocol to enforce nfs mount
1 parent a33e816 commit b9ae1e9

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed

pkg/blob/blob.go

Lines changed: 2 additions & 1 deletion
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"
@@ -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/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)