Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.22] feat: provide nfsv3 protocol to enforce nfs mount #1284

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/blob/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const (
Fuse2 = "fuse2"
NFS = "nfs"
AZNFS = "aznfs"
NFSv3 = "nfsv3"
vnetResourceGroupField = "vnetresourcegroup"
vnetNameField = "vnetname"
subnetNameField = "subnetname"
Expand Down Expand Up @@ -145,7 +146,7 @@ const (
)

var (
supportedProtocolList = []string{Fuse, Fuse2, NFS}
supportedProtocolList = []string{Fuse, Fuse2, NFS, AZNFS}
retriableErrors = []string{accountNotProvisioned, tooManyRequests, statusCodeNotFound, containerBeingDeletedDataplaneAPIError, containerBeingDeletedManagementAPIError, clientThrottled}
)

Expand Down Expand Up @@ -681,7 +682,7 @@ func isSupportedProtocol(protocol string) bool {
return true
}
for _, v := range supportedProtocolList {
if protocol == v {
if protocol == v || protocol == NFSv3 {
return true
}
}
Expand Down Expand Up @@ -723,7 +724,7 @@ func isSupportedContainerNamePrefix(prefix string) bool {
// isNFSProtocol checks if the protocol is NFS or AZNFS
func isNFSProtocol(protocol string) bool {
protocol = strings.ToLower(protocol)
return protocol == NFS || protocol == AZNFS
return protocol == NFS || protocol == AZNFS || protocol == NFSv3
}

// get storage account from secrets map
Expand Down
4 changes: 2 additions & 2 deletions pkg/blob/blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1728,8 +1728,8 @@ func TestIsNFSProtocol(t *testing.T) {
expectedResult: true,
},
{
protocol: "NFSv3",
expectedResult: false,
protocol: "nfsv3",
expectedResult: true,
},
{
protocol: "aznfs",
Expand Down
2 changes: 1 addition & 1 deletion pkg/blob/controllerserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func TestCreateVolume(t *testing.T) {
controllerServiceCapability,
}
_, err := d.CreateVolume(context.Background(), req)
expectedErr := status.Errorf(codes.InvalidArgument, "protocol(unit-test) is not supported, supported protocol list: [fuse fuse2 nfs]")
expectedErr := status.Errorf(codes.InvalidArgument, "protocol(unit-test) is not supported, supported protocol list: [fuse fuse2 nfs aznfs]")
if !reflect.DeepEqual(err, expectedErr) {
t.Errorf("actualErr: (%v), expectedErr: (%v)", err, expectedErr)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/blob/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
targetPath, protocol, volumeID, attrib, mountFlags, serverAddress)

mountType := AZNFS
if !d.enableAznfsMount {
if !d.enableAznfsMount || protocol == NFSv3 {
mountType = NFS
}

Expand Down
31 changes: 31 additions & 0 deletions test/e2e/dynamic_provisioning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,37 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
test.Run(ctx, cs, ns)
})

ginkgo.It("enforce with nfs mount [nfs]", func(ctx ginkgo.SpecContext) {
if isAzureStackCloud {
ginkgo.Skip("test case is not available for Azure Stack")
}
pods := []testsuites.PodDetails{
{
Cmd: "echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data",
Volumes: []testsuites.VolumeDetails{
{
ClaimSize: "10Gi",
MountOptions: []string{
"nconnect=8",
},
VolumeMount: testsuites.VolumeMountDetails{
NameGenerate: "test-volume-",
MountPathGenerate: "/mnt/test-",
},
},
},
},
}
test := testsuites.DynamicallyProvisionedCmdVolumeTest{
CSIDriver: testDriver,
Pods: pods,
StorageClassParameters: map[string]string{
"protocol": "nfsv3",
},
}
test.Run(ctx, cs, ns)
})

ginkgo.It("should create a NFSv3 volume on demand with zero mountPermissions [nfs]", func(ctx ginkgo.SpecContext) {
if isAzureStackCloud {
ginkgo.Skip("test case is not available for Azure Stack")
Expand Down
Loading