fix(readonly): honouring readonly flag.

Readonly flag does not come as mount option, it has
separate field to mention readonly flag. ZFS-LocalPV
driver should check that field and add "ro" as mountoption.

Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
Pawan 2020-05-27 14:08:36 +05:30 committed by Kiran Mova
parent d47ec3ba01
commit 42ed7d85ee
2 changed files with 4 additions and 5 deletions

View file

@ -57,10 +57,6 @@ type MountInfo struct {
// on that node
MountPath string `json:"mountPath"`
// ReadOnly specifies if the volume needs
// to be mounted in ReadOnly mode
ReadOnly bool `json:"readOnly"`
// MountOptions specifies the options with
// which mount needs to be attempted
MountOptions []string `json:"mountOptions"`

View file

@ -76,9 +76,12 @@ func GetVolAndMountInfo(
mountinfo.FSType = req.GetVolumeCapability().GetMount().GetFsType()
mountinfo.MountPath = req.GetTargetPath()
mountinfo.ReadOnly = req.GetReadonly()
mountinfo.MountOptions = append(mountinfo.MountOptions, req.GetVolumeCapability().GetMount().GetMountFlags()...)
if req.GetReadonly() {
mountinfo.MountOptions = append(mountinfo.MountOptions, "ro")
}
getOptions := metav1.GetOptions{}
vol, err := volbuilder.NewKubeclient().
WithNamespace(zfs.OpenEBSNamespace).