cephfs: go with default permissions while creating subvolumes

While creating subvolumes, CephFS driver set the mode to `777`
and pass it along to go ceph apis which cause the subvolume
permission to be on 777, however if we create a subvolume
directly in the ceph cluster, the default permission bits are
set which is 755 for the subvolume. This commit try to stick
to the default behaviour even while creating the subvolume.

This also means that we can work with fsgrouppolicy set to
`File` in csiDriver object which is also addressed in this commit.

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal 2022-03-10 18:13:05 +05:30 committed by mergify[bot]
parent 4b709310e2
commit 1856647506
3 changed files with 2 additions and 7 deletions

View File

@ -9,3 +9,4 @@ metadata:
spec: spec:
attachRequired: false attachRequired: false
podInfoOnMount: false podInfoOnMount: false
fsGroupPolicy: File

View File

@ -8,3 +8,4 @@ metadata:
spec: spec:
attachRequired: false attachRequired: false
podInfoOnMount: false podInfoOnMount: false
fsGroupPolicy: File

View File

@ -39,12 +39,6 @@ import (
// taken through this additional cluster information. // taken through this additional cluster information.
var clusterAdditionalInfo = make(map[string]*localClusterState) var clusterAdditionalInfo = make(map[string]*localClusterState)
const (
// modeAllRWX can be used for setting permissions to Read-Write-eXecute
// for User, Group and Other.
modeAllRWX = 0o777
)
// Subvolume holds subvolume information. This includes only the needed members // Subvolume holds subvolume information. This includes only the needed members
// from fsAdmin.SubVolumeInfo. // from fsAdmin.SubVolumeInfo.
type Subvolume struct { type Subvolume struct {
@ -231,7 +225,6 @@ func (s *subVolumeClient) CreateVolume(ctx context.Context) error {
opts := fsAdmin.SubVolumeOptions{ opts := fsAdmin.SubVolumeOptions{
Size: fsAdmin.ByteCount(s.Size), Size: fsAdmin.ByteCount(s.Size),
Mode: modeAllRWX,
} }
if s.Pool != "" { if s.Pool != "" {
opts.PoolLayout = s.Pool opts.PoolLayout = s.Pool