diff options
Diffstat (limited to 'recipes-containers/k3s/k3s/k3s-clean')
-rwxr-xr-x | recipes-containers/k3s/k3s/k3s-clean | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/recipes-containers/k3s/k3s/k3s-clean b/recipes-containers/k3s/k3s/k3s-clean new file mode 100755 index 00000000..8eca918c --- /dev/null +++ b/recipes-containers/k3s/k3s/k3s-clean @@ -0,0 +1,30 @@ +#!/bin/sh -eu +# +# Copyright (C) 2020 Axis Communications AB +# +# SPDX-License-Identifier: Apache-2.0 + +do_unmount() { + [ $# -eq 2 ] || return + local mounts= + while read ignore mount ignore; do + case $mount in + $1/*|$2/*) + mounts="$mount $mounts" + ;; + esac + done </proc/self/mounts + [ -z "$mounts" ] || umount $mounts +} + +do_unmount /run/k3s /var/lib/rancher/k3s + +# The lines below come from install.sh's create_killall() function: +ip link show 2>/dev/null | grep 'master cni0' | while read ignore iface ignore; do + iface=${iface%%@*} + [ -z "$iface" ] || ip link delete $iface +done + +ip link delete cni0 +ip link delete flannel.1 +rm -rf /var/lib/cni/ |