fail fast with wrong kubelet rootdir (#3331) (#3451)

* fail fast with wrong kubelet rootdir



* check /pods dir



* check kubelet rootdir /plugins



* function check_directory



* add more info



---------

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>
Co-authored-by: wangshulin <89928606+wangshli@users.noreply.github.com>
This commit is contained in:
TzZtzt 2023-09-13 11:27:59 +08:00 committed by GitHub
parent 76e2621a32
commit 2a141d783c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 2 deletions

View File

@ -1,7 +1,20 @@
#!/usr/bin/env bash
set -xe
rm -f $KUBELET_ROOTDIR/csi-plugins/fuse.csi.fluid.io/csi.sock
mkdir -p $KUBELET_ROOTDIR/csi-plugins/fuse.csi.fluid.io
# Function to check if a directory exists
check_kubelet_rootdir_subfolder() {
local dir="$1"
if [ ! -d "$dir" ]; then
echo "Error: subfolder $dir does not exist, please check whether KUBELET_ROOTDIR $KUBELET_ROOTDIR is configured correctly."
exit 1
fi
}
check_kubelet_rootdir_subfolder "$KUBELET_ROOTDIR/pods"
check_kubelet_rootdir_subfolder "$KUBELET_ROOTDIR/plugins"
rm -f "$KUBELET_ROOTDIR/csi-plugins/fuse.csi.fluid.io/csi.sock"
mkdir -p "$KUBELET_ROOTDIR/csi-plugins/fuse.csi.fluid.io"
fluid-csi start $@