2 ##############################################################################
3 # Copyright (c) 2019 Huawei Tech and others. #
5 # All rights reserved. This program and the accompanying materials #
6 # are made available under the terms of the Apache License, Version 2.0 #
7 # which accompanies this distribution, and is available at #
8 # http://www.apache.org/licenses/LICENSE-2.0 #
9 ##############################################################################
13 if [ -f "$HOME/testk8s-nginx.yaml" ]; then
14 cd $HOME && kubectl delete -f test-k8snginx.yaml && rm -rf testk8s-nginx.yaml
15 echo "testk8s-nginx.yaml cleaned"
18 if [ -d "/var/lib/etcd" ]; then
19 sudo rm -rf /var/lib/etcd
23 KUBEADM_RESET="sudo kubeadm reset"
24 ETCD_CLEAN="sudo rm -rf /var/lib/etcd"
25 CLEANUP_PROM_CADVISOR="cd eliot/scripts/ci_management && ./uninstall_cadvisor.sh"
27 # Read all the Worker Node details from nodelist file.
32 nodeusr=$(echo ${nodeinfo} | cut -d"|" -f1)
33 nodeip=$(echo ${nodeinfo} | cut -d"|" -f2)
34 nodepaswd=$(echo ${nodeinfo} | cut -d"|" -f3)
35 sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${KUBEADM_RESET}
36 sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${ETCD_CLEAN}
37 sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${CLEANUP_PROM_CADVISOR}
38 done < nodelist > /dev/null 2>&1