mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
CSI inline volumes should support fsGroup
This commit is contained in:
parent
f10cd679eb
commit
88a1962e56
@ -404,10 +404,7 @@ func (c *csiMountMgr) supportsFSGroup(fsType string, fsGroup *int64, driverPolic
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.spec.PersistentVolume == nil {
|
if c.spec.PersistentVolume != nil {
|
||||||
klog.V(4).Info(log("mounter.SetupAt Warning: skipping fsGroup permission change, no access mode available. The volume may only be accessible to root users."))
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if c.spec.PersistentVolume.Spec.AccessModes == nil {
|
if c.spec.PersistentVolume.Spec.AccessModes == nil {
|
||||||
klog.V(4).Info(log("mounter.SetupAt WARNING: skipping fsGroup, access modes not provided"))
|
klog.V(4).Info(log("mounter.SetupAt WARNING: skipping fsGroup, access modes not provided"))
|
||||||
return false
|
return false
|
||||||
@ -417,6 +414,17 @@ func (c *csiMountMgr) supportsFSGroup(fsType string, fsGroup *int64, driverPolic
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
} else if c.spec.Volume != nil && c.spec.Volume.CSI != nil {
|
||||||
|
if !utilfeature.DefaultFeatureGate.Enabled(features.CSIInlineVolume) {
|
||||||
|
klog.V(4).Info(log("mounter.SetupAt WARNING: skipping fsGroup, CSIInlineVolume feature required"))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// Inline CSI volumes are always mounted with RWO AccessMode by SetUpAt
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
klog.V(4).Info(log("mounter.SetupAt WARNING: skipping fsGroup, unsupported volume type"))
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// isDirMounted returns the !notMounted result from IsLikelyNotMountPoint check
|
// isDirMounted returns the !notMounted result from IsLikelyNotMountPoint check
|
||||||
|
@ -1201,6 +1201,24 @@ func Test_csiMountMgr_supportsFSGroup(t *testing.T) {
|
|||||||
},
|
},
|
||||||
want: true,
|
want: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "driverPolicy is ReadWriteOnceWithFSTypeFSGroupPolicy with CSI inline volume",
|
||||||
|
args: args{
|
||||||
|
fsGroup: new(int64),
|
||||||
|
fsType: "ext4",
|
||||||
|
driverPolicy: storage.ReadWriteOnceWithFSTypeFSGroupPolicy,
|
||||||
|
},
|
||||||
|
fields: fields{
|
||||||
|
spec: volume.NewSpecFromVolume(&api.Volume{
|
||||||
|
VolumeSource: api.VolumeSource{
|
||||||
|
CSI: &api.CSIVolumeSource{
|
||||||
|
Driver: testDriver,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
want: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
Loading…
Reference in New Issue
Block a user