Skip to content

Commit

Permalink
Add a change for killall to not unmount server and agent directory
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Savian <[email protected]>

Add recursive search and deletion of unmounted/mounted dirs in killall

Signed-off-by: Vitor Savian <[email protected]>
  • Loading branch information
vitorsavian committed Jun 29, 2024
1 parent aa4794b commit 50cb1c5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -829,11 +829,27 @@ do_unmount_and_remove() {
set -x
}
clean_mounted_directory() {
for path in "$1"/*; do
if [ -d "$path" ]; then
if grep -q "$path" /proc/mounts; then
clean_mounted_directory "$path"
else
rm -rf "$path"
fi
else
rm "$path"
fi
done
}
do_unmount_and_remove '/run/k3s'
do_unmount_and_remove '/var/lib/rancher/k3s'
do_unmount_and_remove '/var/lib/rancher/k3s/data'
do_unmount_and_remove '/var/lib/rancher/k3s/storage'
do_unmount_and_remove '/var/lib/kubelet/pods'
do_unmount_and_remove '/var/lib/kubelet/plugins'
do_unmount_and_remove '/run/netns/cni-'
clean_mounted_directory '/var/lib/rancher/k3s'
# Remove CNI namespaces
ip netns show 2>/dev/null | grep cni- | xargs -r -t -n 1 ip netns delete
Expand Down
2 changes: 1 addition & 1 deletion install.sh.sha256sum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
696c6a93262b3e1f06a78841b8a82c238a8f17755824c024baad652b18bc92bc install.sh
a2b1e04080530d80c0446df5d1504ce4e58ce3ff3c1f3347eeb6198575124851 install.sh

0 comments on commit 50cb1c5

Please sign in to comment.