Skip to content

Commit 277e8b8

Browse files
authored
Merge pull request #2234 from k8s-infra-cherrypick-robot/cherry-pick-2231-to-release-1.25
[release-1.25] fix: skip chmod setting in readonly mode
2 parents 4365ab6 + ffb724b commit 277e8b8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pkg/blob/nodeserver.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,12 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
389389
}
390390

391391
if performChmodOp {
392-
if err := chmodIfPermissionMismatch(targetPath, os.FileMode(mountPermissions)); err != nil {
393-
return nil, status.Error(codes.Internal, err.Error())
392+
if !isReadOnlyFromCapability(volumeCapability) {
393+
if err := chmodIfPermissionMismatch(targetPath, os.FileMode(mountPermissions)); err != nil {
394+
return nil, status.Error(codes.Internal, err.Error())
395+
}
396+
} else {
397+
klog.V(2).Infof("skip chmod on targetPath(%s) since it's a read-only mount", targetPath)
394398
}
395399
} else {
396400
klog.V(2).Infof("skip chmod on targetPath(%s) since mountPermissions is set as 0", targetPath)

test/e2e/dynamic_provisioning_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
270270
VolumeMount: testsuites.VolumeMountDetails{
271271
NameGenerate: "test-volume-",
272272
MountPathGenerate: "/mnt/test-",
273+
ReadOnly: true,
273274
},
274275
AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadOnlyMany},
275276
},

0 commit comments

Comments
 (0)