From 8f325ecab71193537c7545d4b5ec50476c728bdd Mon Sep 17 00:00:00 2001 From: frankleaf <62129564+frankleaf@users.noreply.github.com> Date: Fri, 20 May 2022 14:32:30 +0800 Subject: [PATCH] refine some parameter for read only (#1853) Signed-off-by: frankleaf --- pkg/ddc/jindofsx/transform.go | 36 ++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/pkg/ddc/jindofsx/transform.go b/pkg/ddc/jindofsx/transform.go index 940b53e3023..3db2ca98581 100644 --- a/pkg/ddc/jindofsx/transform.go +++ b/pkg/ddc/jindofsx/transform.go @@ -415,11 +415,15 @@ func (e *JindoFSxEngine) transformResources(runtime *datav1alpha1.JindoRuntime, func (e *JindoFSxEngine) transformFuse(runtime *datav1alpha1.JindoRuntime, value *Jindo) { // default enable data-cache and disable meta-cache properties := map[string]string{ - "fs.jindofsx.request.user": "root", - "fs.jindofsx.data.cache.enable": "true", - "fs.jindofsx.meta.cache.enable": "false", - "fs.jindofsx.tmp.data.dir": "/tmp", - "fs.jindofsx.client.metrics.enable": "true", + "fs.jindofsx.request.user": "root", + "fs.jindofsx.data.cache.enable": "true", + "fs.jindofsx.meta.cache.enable": "true", + "fs.jindofsx.tmp.data.dir": "/tmp", + "fs.jindofsx.client.metrics.enable": "true", + "fs.oss.download.queue.size": "16", + "fs.oss.download.thread.concurrency": "32", + "fs.s3.download.queue.size": "16", + "fs.s3.download.thread.concurrency": "32", } for k, v := range value.Master.FileStoreProperties { @@ -523,8 +527,30 @@ func (e *JindoFSxEngine) transformWorkerMountPath(originPath []string) map[strin func (e *JindoFSxEngine) transformFuseArg(runtime *datav1alpha1.JindoRuntime, dataset *datav1alpha1.Dataset) []string { fuseArgs := []string{} + readOnly := false + runtimeInfo := e.runtimeInfo + if runtimeInfo != nil { + accessModes, err := utils.GetAccessModesOfDataset(e.Client, runtimeInfo.GetName(), runtimeInfo.GetNamespace()) + if err != nil { + e.Log.Info("Error:", "err", err) + } + if len(accessModes) > 0 { + for _, mode := range accessModes { + if mode == corev1.ReadOnlyMany { + readOnly = true + } + } + } + } if len(runtime.Spec.Fuse.Args) > 0 { fuseArgs = runtime.Spec.Fuse.Args + } else { + fuseArgs = append(fuseArgs, "-okernel_cache") + if readOnly { + fuseArgs = append(fuseArgs, "-oro") + fuseArgs = append(fuseArgs, "-oattr_timeout=7200") + fuseArgs = append(fuseArgs, "-oentry_timeout=7200") + } } if runtime.Spec.Master.Disabled && runtime.Spec.Worker.Disabled { fuseArgs = append(fuseArgs, "-ouri="+dataset.Spec.Mounts[0].MountPoint)