Skip to content

Commit

Permalink
juicefs: use exec in juicefs pod to avoid ignore signal (#4236)
Browse files Browse the repository at this point in the history
* feat: use exec in juicefs pod to avoid ignore signal

Signed-off-by: zwwhdls <zww@hdls.me>

* feat: use exec in juicefs pod to avoid ignore signal

Signed-off-by: zwwhdls <zww@hdls.me>

* fix unittest

Signed-off-by: zwwhdls <zww@hdls.me>

---------

Signed-off-by: zwwhdls <zww@hdls.me>
  • Loading branch information
zwwhdls authored Jul 26, 2024
1 parent 81699c0 commit 1386ef5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions pkg/ddc/juicefs/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ func (j *JuiceFSEngine) genWorkerMount(value *JuiceFS, workerOptionMap map[strin
workerOptionMap["metrics"] = fmt.Sprintf("0.0.0.0:%d", metricsPort)
}
mountArgsWorker = []string{
"exec",
common.JuiceFSCeMountPath,
value.Source,
security.EscapeBashStr(value.Worker.MountPath),
Expand All @@ -226,6 +227,7 @@ func (j *JuiceFSEngine) genWorkerMount(value *JuiceFS, workerOptionMap map[strin
delete(workerOptionMap, "no-sharing")

mountArgsWorker = []string{
"exec",
common.JuiceFSMountPath,
value.Source,
security.EscapeBashStr(value.Worker.MountPath),
Expand Down
2 changes: 2 additions & 0 deletions pkg/ddc/juicefs/transform_fuse.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ func (j *JuiceFSEngine) genFuseMount(value *JuiceFS, optionMap map[string]string
setDefaultOptions(optionMap, "metrics", fmt.Sprintf("0.0.0.0:%d", metricsPort))

mountArgs = []string{
"exec",
common.JuiceFSCeMountPath,
value.Source,
security.EscapeBashStr(value.Fuse.MountPath),
Expand All @@ -382,6 +383,7 @@ func (j *JuiceFSEngine) genFuseMount(value *JuiceFS, optionMap map[string]string
setDefaultOptions(optionMap, "no-sharing", "")

mountArgs = []string{
"exec",
common.JuiceFSMountPath,
value.Source,
security.EscapeBashStr(value.Fuse.MountPath),
Expand Down
10 changes: 5 additions & 5 deletions pkg/ddc/juicefs/transform_fuse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ func TestJuiceFSEngine_genMount(t *testing.T) {
},
},
wantErr: false,
wantFuseCommand: "/bin/mount.juicefs redis://127.0.0.1:6379 /test -o metrics=0.0.0.0:9567",
wantFuseCommand: "exec /bin/mount.juicefs redis://127.0.0.1:6379 /test -o metrics=0.0.0.0:9567",
wantFuseStatCmd: "stat -c %i /test",
},
{
Expand Down Expand Up @@ -830,7 +830,7 @@ func TestJuiceFSEngine_genMount(t *testing.T) {
options: map[string]string{"verbose": ""},
},
wantErr: false,
wantFuseCommand: "/bin/mount.juicefs redis://127.0.0.1:6379 /test -o verbose,metrics=0.0.0.0:9567",
wantFuseCommand: "exec /bin/mount.juicefs redis://127.0.0.1:6379 /test -o verbose,metrics=0.0.0.0:9567",
wantFuseStatCmd: "stat -c %i /test",
},
{
Expand Down Expand Up @@ -863,7 +863,7 @@ func TestJuiceFSEngine_genMount(t *testing.T) {
},
},
wantErr: false,
wantFuseCommand: "/sbin/mount.juicefs test-enterprise /test -o foreground,no-update,cache-group=fluid-test-enterprise,no-sharing",
wantFuseCommand: "exec /sbin/mount.juicefs test-enterprise /test -o foreground,no-update,cache-group=fluid-test-enterprise,no-sharing",
wantFuseStatCmd: "stat -c %i /test",
},
{
Expand Down Expand Up @@ -897,7 +897,7 @@ func TestJuiceFSEngine_genMount(t *testing.T) {
options: map[string]string{"cache-group": "test", "verbose": ""},
},
wantErr: false,
wantFuseCommand: "/sbin/mount.juicefs test-enterprise /test -o verbose,foreground,no-update,cache-group=test,no-sharing",
wantFuseCommand: "exec /sbin/mount.juicefs test-enterprise /test -o verbose,foreground,no-update,cache-group=test,no-sharing",
wantFuseStatCmd: "stat -c %i /test",
}, {
name: "test-enterprise-options-with-bucket2",
Expand Down Expand Up @@ -930,7 +930,7 @@ func TestJuiceFSEngine_genMount(t *testing.T) {
options: map[string]string{"cache-group": "test", "verbose": "", JuiceBucket2: "bucket2"},
},
wantErr: false,
wantFuseCommand: "/sbin/mount.juicefs test-enterprise /test -o verbose,foreground,no-update,cache-group=test,no-sharing",
wantFuseCommand: "exec /sbin/mount.juicefs test-enterprise /test -o verbose,foreground,no-update,cache-group=test,no-sharing",
wantFuseStatCmd: "stat -c %i /test",
},
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/ddc/juicefs/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func TestJuiceFSEngine_genWorkerMount(t *testing.T) {
runtime: &datav1alpha1.JuiceFSRuntime{},
},
wantErr: false,
wantWorkerCommand: "/bin/mount.juicefs redis://127.0.0.1:6379 /test-worker -o metrics=0.0.0.0:9567",
wantWorkerCommand: "exec /bin/mount.juicefs redis://127.0.0.1:6379 /test-worker -o metrics=0.0.0.0:9567",
wantWorkerStatCmd: "stat -c %i /test-worker",
},
{
Expand Down Expand Up @@ -372,7 +372,7 @@ func TestJuiceFSEngine_genWorkerMount(t *testing.T) {
}}},
},
wantErr: false,
wantWorkerCommand: "/bin/mount.juicefs redis://127.0.0.1:6379 /test-worker -o metrics=127.0.0.1:9567",
wantWorkerCommand: "exec /bin/mount.juicefs redis://127.0.0.1:6379 /test-worker -o metrics=127.0.0.1:9567",
wantWorkerStatCmd: "stat -c %i /test-worker",
},
{
Expand Down Expand Up @@ -406,7 +406,7 @@ func TestJuiceFSEngine_genWorkerMount(t *testing.T) {
runtime: &datav1alpha1.JuiceFSRuntime{},
},
wantErr: false,
wantWorkerCommand: "/sbin/mount.juicefs test-enterprise /test -o foreground,no-update,cache-group=fluid-test-enterprise",
wantWorkerCommand: "exec /sbin/mount.juicefs test-enterprise /test -o foreground,no-update,cache-group=fluid-test-enterprise",
wantWorkerStatCmd: "stat -c %i /test",
},
{
Expand Down Expand Up @@ -442,7 +442,7 @@ func TestJuiceFSEngine_genWorkerMount(t *testing.T) {
}}},
},
wantErr: false,
wantWorkerCommand: "/sbin/mount.juicefs test-enterprise /test -o verbose,foreground,no-update,cache-group=test",
wantWorkerCommand: "exec /sbin/mount.juicefs test-enterprise /test -o verbose,foreground,no-update,cache-group=test",
wantWorkerStatCmd: "stat -c %i /test",
},
}
Expand Down

0 comments on commit 1386ef5

Please sign in to comment.