Skip to content

Commit

Permalink
fix: csi mount default 0777 0777 (#1092)
Browse files Browse the repository at this point in the history
* fix: csi mount default 0777 0777

* fix: csi mount default 0777 0777
  • Loading branch information
luoyuedong authored Mar 23, 2023
1 parent c712ef0 commit 196fff8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
22 changes: 9 additions & 13 deletions pkg/fs/csiplugin/mount/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
corev1 "k8s.io/api/core/v1"

"github.com/PaddlePaddle/PaddleFlow/pkg/common/schema"
"github.com/PaddlePaddle/PaddleFlow/pkg/fs/client/ufs"
"github.com/PaddlePaddle/PaddleFlow/pkg/fs/common"
"github.com/PaddlePaddle/PaddleFlow/pkg/fs/csiplugin/csiconfig"
"github.com/PaddlePaddle/PaddleFlow/pkg/fs/utils"
Expand Down Expand Up @@ -210,18 +209,15 @@ func (mountInfo *Info) commonOptions() []string {
options = append(options, "--log-level=debug")
}

// s3 default mount permission
if mountInfo.FS.Type == common.S3Type {
if mountInfo.FS.PropertiesMap[common.FileMode] != "" {
options = append(options, fmt.Sprintf("--%s=%s", "file-mode", mountInfo.FS.PropertiesMap[common.FileMode]))
} else {
options = append(options, fmt.Sprintf("--%s=%v", "file-mode", ufs.DefaultFileMode))
}
if mountInfo.FS.PropertiesMap[common.DirMode] != "" {
options = append(options, fmt.Sprintf("--%s=%s", "dir-mode", mountInfo.FS.PropertiesMap[common.DirMode]))
} else {
options = append(options, fmt.Sprintf("--%s=%v", "dir-mode", ufs.DefaultDirMode))
}
if mountInfo.FS.PropertiesMap[common.FileMode] != "" {
options = append(options, fmt.Sprintf("--%s=%s", "file-mode", mountInfo.FS.PropertiesMap[common.FileMode]))
} else {
options = append(options, fmt.Sprintf("--%s=%v", "file-mode", "0777"))
}
if mountInfo.FS.PropertiesMap[common.DirMode] != "" {
options = append(options, fmt.Sprintf("--%s=%s", "dir-mode", mountInfo.FS.PropertiesMap[common.DirMode]))
} else {
options = append(options, fmt.Sprintf("--%s=%v", "dir-mode", "0777"))
}
return options
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/fs/csiplugin/mount/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func TestInfo_MountCmdArgs(t *testing.T) {
CacheConfig: fsCache,
TargetPath: targetPath,
},
want: "/home/paddleflow/pfs-fuse mount --mount-point=/home/paddleflow/mnt/storage --fs-id=fs-root-bos --sts=true --server=paddleflow-server:8999 --block-size=4096 --meta-cache-driver=disk --data-cache-path=/home/paddleflow/pfs-cache/data-cache --meta-cache-path=/home/paddleflow/pfs-cache/meta-cache",
want: "/home/paddleflow/pfs-fuse mount --mount-point=/home/paddleflow/mnt/storage --fs-id=fs-root-bos --sts=true --server=paddleflow-server:8999 --block-size=4096 --meta-cache-driver=disk --file-mode=0777 --dir-mode=0777 --data-cache-path=/home/paddleflow/pfs-cache/data-cache --meta-cache-path=/home/paddleflow/pfs-cache/meta-cache",
},
{
name: "test-bos-err",
Expand Down

0 comments on commit 196fff8

Please sign in to comment.