Remove shared keyspaces for SDC in cleanup
[integration.git] / deployment / heat / onap-rke / scripts / cleanup.sh
1 #!/bin/bash
2
3 IFS='
4 '
5
6 if [ -z $1 ]; then
7         echo "ONAP component name missing"
8         echo "Usage: ./cleanup.sh onap_component_name"
9         exit 1
10 fi
11
12 COMPONENT=$1
13
14 if [ $COMPONENT == "dcae" ] || [ $COMPONENT == "DCAE" ]; then
15         kubectl delete service consul -n onap
16 fi
17
18 if [ $COMPONENT == "sdc" ] || [ $COMPONENT == "SDC" ]; then
19         for keyspace in sdctitan sdcrepository sdcartifact sdccomponent sdcaudit; do
20                 kubectl exec -it dev-cassandra-cassandra-0 -- cqlsh -u cassandra -p cassandra -e "drop keyspace ${keyspace}"
21         done
22 fi
23
24 for op in secrets configmaps pvc pv services deployments statefulsets clusterrolebinding; do
25         ARRAY=(`kubectl get $op -n onap | grep dev-$COMPONENT | awk '{print $1}'`)
26         for i in ${ARRAY[*]}; do
27                 kubectl delete $op -n onap $i
28         done
29 done