Skip to content

Commit

Permalink
remove flannel from /var/lib/cni during reset (#4856)
Browse files Browse the repository at this point in the history
* remove flannel from /var/lib/cni during reset

* just remove all of /var/lib/cni

* fully cleanup flannel, and stop containerd/docker

* add a test for tasks.sh | reset
  • Loading branch information
laverya authored Oct 5, 2023
1 parent 7ad1df5 commit f72032b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
11 changes: 11 additions & 0 deletions scripts/tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,20 @@ function reset() {
rm -rf "$KURL_INSTALL_DIRECTORY"
rm -rf "$KURL_INSTALL_DIRECTORY.repos"

printf "Removing flannel networks\n"
# if /var/lib/cni/flannel exists, remove it entirely
if [ -d /var/lib/cni/flannel ]; then
ip link set cni0 down && ip link set flannel.1 down
ip link delete cni0 && ip link delete flannel.1
rm -rf /var/lib/cni
fi

printf "Killing haproxy\n"
pkill haproxy || true

systemctl stop containerd || true
systemctl stop docker || true

printf "Reset script completed\n"
}

Expand Down
29 changes: 26 additions & 3 deletions testgrid/specs/full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,7 @@
kube_bench_version="$(curl -s https://api.github.com/repos/aquasecurity/kube-bench/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')"
curl -L https://github.com/aquasecurity/kube-bench/releases/download/v${kube_bench_version}/kube-bench_${kube_bench_version}_linux_amd64.tar.gz | tar -xz
./kube-bench --config-dir=`pwd`/cfg --config=`pwd`/cfg/config.yaml --exit-code=1
echo "Checking kubectl with kube/config"
echo "Checking kubectl with kube/config"
echo "Kubeconfig was $KUBECONFIG"
unset KUBECONFIG
kubectl get namespaces
Expand Down Expand Up @@ -2349,7 +2349,7 @@
sudo cat /var/lib/kubelet/config.yaml | grep "cpu: 123m"
sudo cat /var/lib/kubelet/config.yaml | grep "ephemeral-storage: 1.23Gi"
sudo cat /var/lib/kubelet/config.yaml | grep "memory: 123Mi"
echo "Checking kubectl with kube/config"
echo "Checking kubectl with kube/config"
echo "Kubeconfig was $KUBECONFIG"
unset KUBECONFIG
kubectl get namespaces
Expand Down Expand Up @@ -2481,7 +2481,7 @@
source /opt/kurl-testgrid/testhelpers.sh
minio_object_store_info
validate_read_write_object_store rwtest testfile.txt
echo "Checking kubectl with kube/config"
echo "Checking kubectl with kube/config"
echo "Kubeconfig was $KUBECONFIG"
unset KUBECONFIG
kubectl get namespaces
Expand Down Expand Up @@ -2645,3 +2645,26 @@
message: Unexpected port status" > /opt/kurl-testgrid/patchfile.yaml
postUpgradeScript: |
kubectl get installer -A -o yaml | grep 8888
- name: reset and reinstall
installerSpec:
kubernetes:
version: 1.28.x
containerd:
version: latest
flannel:
version: latest
upgradeSpec:
kubernetes:
version: 1.27.x # this is a LOWER version than the installer to ensure that the reset worked
containerd:
version: latest
flannel:
version: latest
postInstallScript: |
echo "export FORCE_RESET=1" > tasks2.sh
cat tasks.sh >> tasks2.sh
cat tasks2.sh | sudo bash -s reset
postUpgradeScript: |
k8sVersion=$(kubectl get nodes -o jsonpath='{.items[0].status.nodeInfo.kubeletVersion}')
echo $k8sVersion | grep 1.27

0 comments on commit f72032b

Please sign in to comment.