Mount ufs volumes according to datasets' accessModes (#3634)

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
This commit is contained in:
TzZtzt 2023-12-12 12:07:51 +08:00 committed by GitHub
parent f61c3d3aae
commit 25212a06d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 8 deletions

View File

@ -303,11 +303,17 @@ func (e *JindoCacheEngine) transformMaster(runtime *datav1alpha1.JindoRuntime, m
}
// Default to mount ufs volumes in read-only mode. Mount in read-write mode only when
// the dataset is set to ReadWriteMany explicitly.
ufsVolumeReadOnly := true
// the dataset's accessMode is set explicitly.
ufsVolumeReadOnly := false
accessModes := dataset.Spec.AccessModes
if len(accessModes) == 1 && accessModes[0] == corev1.ReadWriteMany {
ufsVolumeReadOnly = false
if len(accessModes) == 0 {
ufsVolumeReadOnly = true
} else {
for _, mode := range accessModes {
if mode == corev1.ReadOnlyMany {
ufsVolumeReadOnly = true
}
}
}
// Split MountPoint into PVC name and subpath (if it contains a subpath)

View File

@ -257,11 +257,17 @@ func (e *JindoFSxEngine) transformMaster(runtime *datav1alpha1.JindoRuntime, met
}
// Default to mount ufs volumes in read-only mode. Mount in read-write mode only when
// the dataset is set to ReadWriteMany explicitly.
ufsVolumeReadOnly := true
// the dataset's accessMode is set explicitly.
ufsVolumeReadOnly := false
accessModes := dataset.Spec.AccessModes
if len(accessModes) == 1 && accessModes[0] == corev1.ReadWriteMany {
ufsVolumeReadOnly = false
if len(accessModes) == 0 {
ufsVolumeReadOnly = true
} else {
for _, mode := range accessModes {
if mode == corev1.ReadOnlyMany {
ufsVolumeReadOnly = true
}
}
}
// Split MountPoint into PVC name and subpath (if it contains a subpath)