Skip to content

Commit 9415076

Browse files
committed
fix: gid mount option setting
fix
1 parent dc4be68 commit 9415076

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

pkg/blob/nodeserver.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,8 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
379379
}
380380

381381
if !checkGidPresentInMountFlags(mountFlags) && volumeMountGroup != "" {
382-
mountOptions = append(mountOptions, fmt.Sprintf("gid=%s", volumeMountGroup))
382+
klog.V(2).Infof("append volumeMountGroup %s", volumeMountGroup)
383+
mountOptions = append(mountOptions, fmt.Sprintf("-o gid=%s", volumeMountGroup))
383384
}
384385

385386
tmpPath := fmt.Sprintf("%s/%s", "/mnt", volumeID)
@@ -677,7 +678,7 @@ func waitForMount(path string, intervel, timeout time.Duration) error {
677678

678679
func checkGidPresentInMountFlags(mountFlags []string) bool {
679680
for _, mountFlag := range mountFlags {
680-
if strings.HasPrefix(mountFlag, "gid") {
681+
if strings.Contains(mountFlag, "gid=") {
681682
return true
682683
}
683684
}

pkg/blob/nodeserver_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,11 @@ func TestCheckGidPresentInMountFlags(t *testing.T) {
843843
MountFlags: []string{"gid=3000"},
844844
result: true,
845845
},
846+
{
847+
desc: "[Success] Gid present in mount flags",
848+
MountFlags: []string{"-o gid=3000"},
849+
result: true,
850+
},
846851
{
847852
desc: "[Success] Gid not present in mount flags",
848853
MountFlags: []string{},

test/external-e2e/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ if [ ! -z ${EXTERNAL_E2E_TEST_NFS} ]; then
7575
echo "begin to run NFSv3 tests ...."
7676
cp deploy/example/storageclass-blob-nfs.yaml /tmp/csi/storageclass.yaml
7777
ginkgo -p -v --fail-fast --flake-attempts 2 -focus="External.Storage.*$DRIVER.csi.azure.com" \
78-
-skip='\[Disruptive\]|should concurrently access the single volume from pods on different node|pod created with an initial fsgroup, volume contents ownership changed via chgrp in first pod, new pod with same fsgroup skips ownership changes to the volume contents|should provision storage with any volume data source|should mount multiple PV pointing to the same storage on the same node|should access to two volumes with the same volume mode and retain data across pod recreation on different node' kubernetes/test/bin/e2e.test -- \
78+
-skip='\[Disruptive\]|should concurrently access the single volume from pods on different node|pod created with an initial fsgroup, volume contents ownership changed via chgrp in first pod, new pod with same fsgroup skips ownership changes to the volume contents|should provision storage with any volume data source|should mount multiple PV pointing to the same storage on the same node|should access to two volumes with the same volume mode and retain data across pod recreation on different node|pod created with an initial fsgroup, volume contents ownership changed via chgrp in first pod, new pod with same fsgroup applied to the volume contents' kubernetes/test/bin/e2e.test -- \
7979
-storage.testdriver=$PROJECT_ROOT/test/external-e2e/testdriver-nfs.yaml \
8080
--kubeconfig=$KUBECONFIG
8181
fi

0 commit comments

Comments
 (0)