aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/oneclick/tools/autoCleanConfig.bash
blob: e274e0d0c598421ae8f25f337f7cfaf0ebc8f618 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
########################################################################################
# This script wraps {$OOM}/kubernetes/oneclick/deleteAll.sh script along with          #
# the following steps to clean up ONAP configure for specified namespace:              #
#     - remove namespace                                                               #
#     - remove release                                                                 #
#     - remove shared directory                                                        #
#                                                                                      #
# To run it, just enter the following command:                                         #
#    ./autoCleanConfig.bash <namespace, default is "onap">                             #
########################################################################################
#!/bin/bash


NS=$1
if [[ -z $NS ]]
then
  echo "Namespace is not specified, use onap namespace."
  NS="onap"
fi

echo "Clean up $NS configuration"
cd ..
./deleteAll.bash -n $NS -y
cd -

echo "----------------------------------------------
Force remove namespace..."
kubectl delete namespace $NS
echo "...done : kubectl get namespace
-----------------------------------------------
>>>>>>>>>>>>>> k8s namespace"
kubectl get namespace
while [[ ! -z `kubectl get namespace|grep $NS` ]]
do
  echo "Wait for namespace $NS to be deleted
-----------------------------------------------
>>>>>>>>>>>>>> k8s namespace"
  kubectl get namespace
  sleep 2
done

echo "Force delete helm process ..."
helm delete $NS-config --purge --debug
echo "...done : helm ls --all
 -----------------------------------------------
>>>>>>>>>>>>>> helm"
helm ls --all

echo "Remove $NS dockerdata..."
sudo rm -rf /dockerdata-nfs/onap
echo "...done : ls -altr /dockerdata-nfs
 -----------------------------------------------
>>>>>>>>>>>>>> /dockerdata-nfs directory"
ls -altr /dockerdata-nfs