beili.zhou | ab1c1ab | 2017-12-07 12:05:06 -0500 | [diff] [blame] | 1 | ######################################################################################## |
| 2 | # This script wraps {$OOM}/kubernetes/oneclick/deleteAll.sh script along with # |
| 3 | # the following steps to clean up ONAP configure for specified namespace: # |
| 4 | # - remove namespace # |
| 5 | # - remove release # |
| 6 | # - remove shared directory # |
| 7 | # # |
| 8 | # To run it, just enter the following command: # |
| 9 | # ./autoCleanConfig.bash <namespace, default is "onap"> # |
| 10 | ######################################################################################## |
| 11 | #!/bin/bash |
| 12 | |
| 13 | |
| 14 | NS=$1 |
| 15 | if [[ -z $NS ]] |
| 16 | then |
| 17 | echo "Namespace is not specified, use onap namespace." |
| 18 | NS="onap" |
| 19 | fi |
| 20 | |
| 21 | echo "Clean up $NS configuration" |
| 22 | cd .. |
| 23 | ./deleteAll.bash -n $NS -y |
| 24 | cd - |
| 25 | |
| 26 | echo "---------------------------------------------- |
| 27 | Force remove namespace..." |
| 28 | kubectl delete namespace $NS |
| 29 | echo "...done : kubectl get namespace |
| 30 | ----------------------------------------------- |
| 31 | >>>>>>>>>>>>>> k8s namespace" |
| 32 | kubectl get namespace |
| 33 | while [[ ! -z `kubectl get namespace|grep $NS` ]] |
| 34 | do |
| 35 | echo "Wait for namespace $NS to be deleted |
| 36 | ----------------------------------------------- |
| 37 | >>>>>>>>>>>>>> k8s namespace" |
| 38 | kubectl get namespace |
| 39 | sleep 2 |
| 40 | done |
| 41 | |
| 42 | echo "Force delete helm process ..." |
| 43 | helm delete $NS-config --purge --debug |
| 44 | echo "...done : helm ls --all |
| 45 | ----------------------------------------------- |
| 46 | >>>>>>>>>>>>>> helm" |
| 47 | helm ls --all |
| 48 | |
| 49 | echo "Remove $NS dockerdata..." |
| 50 | sudo rm -rf /dockerdata-nfs/onap |
| 51 | echo "...done : ls -altr /dockerdata-nfs |
| 52 | ----------------------------------------------- |
| 53 | >>>>>>>>>>>>>> /dockerdata-nfs directory" |
| 54 | ls -altr /dockerdata-nfs |