diff --git a/pkg/application/inject/fuse/poststart/check_fuse_app.go b/pkg/application/inject/fuse/poststart/check_fuse_app.go index d1f9a4cdebd..2dd783d9ff7 100644 --- a/pkg/application/inject/fuse/poststart/check_fuse_app.go +++ b/pkg/application/inject/fuse/poststart/check_fuse_app.go @@ -105,7 +105,8 @@ func (a *ScriptGeneratorForApp) getConfigmapName() string { func (a *ScriptGeneratorForApp) GetPostStartCommand(mountPaths string, mountTypes string) (handler *corev1.LifecycleHandler) { // Return non-null post start command only when PostStartInjeciton is enabled // https://github.com/kubernetes/kubernetes/issues/25766 - cmd := []string{"bash", "-c", fmt.Sprintf("time %s %s %s >> /proc/1/fd/1", appScriptPath, mountPaths, mountTypes)} + // https://github.com/fluid-cloudnative/fluid/issues/4455 + cmd := []string{"bash", "-c", fmt.Sprintf("while [ ! -e /proc/1/fd/1 ]; do sleep 1; done; bash -c 'time %s %s %s >> /proc/1/fd/1'", appScriptPath, mountPaths, mountTypes)} handler = &corev1.LifecycleHandler{ Exec: &corev1.ExecAction{Command: cmd}, } diff --git a/pkg/application/inject/fuse/poststart/check_fuse_default.go b/pkg/application/inject/fuse/poststart/check_fuse_default.go index 5a06b433f11..0cd2539348f 100644 --- a/pkg/application/inject/fuse/poststart/check_fuse_default.go +++ b/pkg/application/inject/fuse/poststart/check_fuse_default.go @@ -86,7 +86,8 @@ func NewDefaultPostStartScriptGenerator() *defaultPostStartScriptGenerator { func (g *defaultPostStartScriptGenerator) GetPostStartCommand(mountPath, mountType, subPath string) (handler *corev1.LifecycleHandler) { // https://github.com/kubernetes/kubernetes/issues/25766 - cmd := []string{"bash", "-c", fmt.Sprintf("time %s %s %s %s >> /proc/1/fd/1", g.scriptMountPath, mountPath, mountType, subPath)} + // https://github.com/fluid-cloudnative/fluid/issues/4455 + cmd := []string{"bash", "-c", fmt.Sprintf("while [ ! -e /proc/1/fd/1 ]; do sleep 1; done; bash -c 'time %s %s %s %s >> /proc/1/fd/1'", g.scriptMountPath, mountPath, mountType, subPath)} return &corev1.LifecycleHandler{ Exec: &corev1.ExecAction{Command: cmd}, diff --git a/pkg/application/inject/fuse/poststart/check_fuse_unprivileged.go b/pkg/application/inject/fuse/poststart/check_fuse_unprivileged.go index ea6180c525b..ec7e8ee8b8b 100644 --- a/pkg/application/inject/fuse/poststart/check_fuse_unprivileged.go +++ b/pkg/application/inject/fuse/poststart/check_fuse_unprivileged.go @@ -49,7 +49,8 @@ func NewUnprivilegedPostStartScriptGenerator() *unprivilegedPostStartScriptGener } func (g *unprivilegedPostStartScriptGenerator) GetPostStartCommand() (handler *corev1.LifecycleHandler) { - cmd := []string{"bash", "-c", fmt.Sprintf("time %s >> /proc/1/fd/1", g.scriptMountPath)} + // https://github.com/fluid-cloudnative/fluid/issues/4455 + cmd := []string{"bash", "-c", fmt.Sprintf("while [ ! -e /proc/1/fd/1 ]; do sleep 1; done; bash -c 'time %s >> /proc/1/fd/1'", g.scriptMountPath)} return &corev1.LifecycleHandler{ Exec: &corev1.ExecAction{Command: cmd},