mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
Add support for mount options to CSI drivers
This commit is contained in:
parent
539bdbc355
commit
65d3beb820
@ -276,6 +276,7 @@ func (m *csiBlockMapper) MapDevice(devicePath, globalMapPath, volumeMapPath, vol
|
|||||||
csiSource.VolumeAttributes,
|
csiSource.VolumeAttributes,
|
||||||
nodePublishSecrets,
|
nodePublishSecrets,
|
||||||
fsTypeBlockName,
|
fsTypeBlockName,
|
||||||
|
[]string{},
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -48,6 +48,7 @@ type csiClient interface {
|
|||||||
volumeAttribs map[string]string,
|
volumeAttribs map[string]string,
|
||||||
nodePublishSecrets map[string]string,
|
nodePublishSecrets map[string]string,
|
||||||
fsType string,
|
fsType string,
|
||||||
|
mountOptions []string,
|
||||||
) error
|
) error
|
||||||
NodeUnpublishVolume(
|
NodeUnpublishVolume(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
@ -113,6 +114,7 @@ func (c *csiDriverClient) NodePublishVolume(
|
|||||||
volumeAttribs map[string]string,
|
volumeAttribs map[string]string,
|
||||||
nodePublishSecrets map[string]string,
|
nodePublishSecrets map[string]string,
|
||||||
fsType string,
|
fsType string,
|
||||||
|
mountOptions []string,
|
||||||
) error {
|
) error {
|
||||||
glog.V(4).Info(log("calling NodePublishVolume rpc [volid=%s,target_path=%s]", volID, targetPath))
|
glog.V(4).Info(log("calling NodePublishVolume rpc [volid=%s,target_path=%s]", volID, targetPath))
|
||||||
if volID == "" {
|
if volID == "" {
|
||||||
@ -153,7 +155,8 @@ func (c *csiDriverClient) NodePublishVolume(
|
|||||||
} else {
|
} else {
|
||||||
req.VolumeCapability.AccessType = &csipb.VolumeCapability_Mount{
|
req.VolumeCapability.AccessType = &csipb.VolumeCapability_Mount{
|
||||||
Mount: &csipb.VolumeCapability_MountVolume{
|
Mount: &csipb.VolumeCapability_MountVolume{
|
||||||
FsType: fsType,
|
FsType: fsType,
|
||||||
|
MountFlags: mountOptions,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ func (c *fakeCsiDriverClient) NodePublishVolume(
|
|||||||
volumeAttribs map[string]string,
|
volumeAttribs map[string]string,
|
||||||
nodePublishSecrets map[string]string,
|
nodePublishSecrets map[string]string,
|
||||||
fsType string,
|
fsType string,
|
||||||
|
mountOptions []string,
|
||||||
) error {
|
) error {
|
||||||
c.t.Log("calling fake.NodePublishVolume...")
|
c.t.Log("calling fake.NodePublishVolume...")
|
||||||
req := &csipb.NodePublishVolumeRequest{
|
req := &csipb.NodePublishVolumeRequest{
|
||||||
@ -74,7 +75,8 @@ func (c *fakeCsiDriverClient) NodePublishVolume(
|
|||||||
},
|
},
|
||||||
AccessType: &csipb.VolumeCapability_Mount{
|
AccessType: &csipb.VolumeCapability_Mount{
|
||||||
Mount: &csipb.VolumeCapability_MountVolume{
|
Mount: &csipb.VolumeCapability_MountVolume{
|
||||||
FsType: fsType,
|
FsType: fsType,
|
||||||
|
MountFlags: mountOptions,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -237,6 +239,7 @@ func TestClientNodePublishVolume(t *testing.T) {
|
|||||||
map[string]string{"attr0": "val0"},
|
map[string]string{"attr0": "val0"},
|
||||||
map[string]string{},
|
map[string]string{},
|
||||||
tc.fsType,
|
tc.fsType,
|
||||||
|
[]string{},
|
||||||
)
|
)
|
||||||
|
|
||||||
if tc.mustFail && err == nil {
|
if tc.mustFail && err == nil {
|
||||||
|
@ -195,6 +195,7 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error {
|
|||||||
attribs,
|
attribs,
|
||||||
nodePublishSecrets,
|
nodePublishSecrets,
|
||||||
fsType,
|
fsType,
|
||||||
|
c.spec.PersistentVolume.Spec.MountOptions,
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -333,7 +333,10 @@ func (p *csiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.S
|
|||||||
func (p *csiPlugin) SupportsMountOption() bool {
|
func (p *csiPlugin) SupportsMountOption() bool {
|
||||||
// TODO (vladimirvivien) use CSI VolumeCapability.MountVolume.mount_flags
|
// TODO (vladimirvivien) use CSI VolumeCapability.MountVolume.mount_flags
|
||||||
// to probe for the result for this method
|
// to probe for the result for this method
|
||||||
return false
|
// (bswartz) Until the CSI spec supports probing, our only option is to
|
||||||
|
// make plugins register their support for mount options or lack thereof
|
||||||
|
// directly with kubernetes.
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *csiPlugin) SupportsBulkVolumeVerification() bool {
|
func (p *csiPlugin) SupportsBulkVolumeVerification() bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user