2 ##############################################################################
3 # Copyright © 2018 AT&T Intellectual Property. All rights reserved. #
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may #
6 # not use this file except in compliance with the License. #
8 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ##############################################################################
19 read -p "Are you sure you wish to continue? (y/n)" REPLY
20 if [ "$REPLY" != "y" ]; then
27 # Check that we are root
28 if [[ $(whoami) != "root" ]]
30 echo "Must be root to run $0"
34 export KUBECONFIG=/etc/kubernetes/admin/kubeconfig.yaml
36 kubectl drain --delete-local-data --force $(hostname)
37 systemctl stop kubelet
38 df -lh | awk '{ print $6 }' | grep -i kubelet | xargs -I {} umount -f -l {}
39 df -lh | awk '{ print $6 }' | grep -i docker | grep -v "/var/lib" | xargs -I {} umount -f -l {}
40 umount -f -l /run/user/0
42 docker rm -fv $(docker ps -aq)
44 #systemctl stop docker
45 apt-get remove --autoremove --purge -y docker-engine=1.13.1-0~ubuntu-xenial socat=1.7.3.1-1
47 rm -rf /dev/docker-data
48 rm -rf /var/lib/docker/*
50 rm -rf /etc/systemd/system/docker.service.d
51 rm -rf /var/lib/dockershim
54 rm -rf /var/lib/openstack-helm
56 dd if=/dev/zero of=/dev/sdb bs=512 count=1 conv=notrunc
57 dd if=/dev/zero of=/dev/sdc bs=512 count=1 conv=notrunc
58 rm -rf /var/lib/openstack-helm/ceph/journal0/*
59 rm -rf /var/lib/openstack-helm/ceph/journal1/*
62 rm -rf /etc/kubernetes
63 rm -rf /usr/local/bin/kubectl
64 rm -rf /usr/local/bin/kubelet
65 rm -rf /var/lib/kubelet
66 rm -rf /etc/systemd/system/kubelet
67 rm -rf /etc/systemd/system/kubelet.service
69 # apt-get install creates the following directory
70 rm -rf /etc/systemd/system/kubelet.service.d/
72 rm -rf /var/log/containers
75 rm -rf /var/lib/auxiliary-etcd-0
76 rm -rf /var/lib/auxiliary-etcd-1
77 rm -rf /var/lib/auxiliary-calico-etcd-0
78 rm -rf /var/lib/auxiliary-calico-etcd-1
79 rm -rf /var/lib/calico-etcd
80 rm -rf /var/lib/kube-etcd
83 rm -rf /var/lib/nova/*
86 rm -rf /dockerdata-nfs/onap/
89 rm -rf /usr/local/bin/bootstrap
90 rm -rf /usr/local/bin/helm
91 rm -rf /var/lib/prom.done
93 # Remove files generated by Promenade
99 rm -rf /var/lib/kubelet/pods