Update repo URL domain name
[it/dep.git] / ricplt / ric_uninstall.sh
1 #!/bin/bash
2
3 ################################################################################
4 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
5 #   Copyright (c) 2019 Nokia.                                                  #
6 #                                                                              #
7 #   Licensed under the Apache License, Version 2.0 (the "License");            #
8 #   you may not use this file except in compliance with the License.           #
9 #   You may obtain a copy of the License at                                    #
10 #                                                                              #
11 #       http://www.apache.org/licenses/LICENSE-2.0                             #
12 #                                                                              #
13 #   Unless required by applicable law or agreed to in writing, software        #
14 #   distributed under the License is distributed on an "AS IS" BASIS,          #
15 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
16 #   See the License for the specific language governing permissions and        #
17 #   limitations under the License.                                             #
18 ################################################################################
19
20 if [ -z "$RICPLT_RELEASE_NAME" ] || [ -z "$RICPLT_COMPONENTS" ] || [ -z "$RICPLT_NAMESPACE" ]; then
21   echo "RICPLT_RELEASE_NAME or RICPLT_COMPONENTS or RICPLT_NAMESPACE unset, loading from ric_env.sh"
22   . ./ric_env.sh
23 fi
24
25 RICPLT_DEPLOYMENT="$RICPLT_RELEASE_NAME"
26
27 echo "Uninstall RIC Platform components $RICPLT_COMPONENTS"
28 echo "name space: $RICPLT_NAMESPACE, Helm release: $RICPLT_DEPLOYMENT"
29
30 echo "Removing Helm deploymentsi ..."
31 helm delete --purge "${RICPLT_RELEASE_NAME}"
32 helm delete --purge pre-"${RICPLT_RELEASE_NAME}"
33 find . -name "common-*" | xargs rm
34 rm -rf ./ric/charts/*
35 echo "Done"
36
37 #echo "Removing RIC resources from Kubernetes ..."
38 #RES=$(kubectl get pods -n "$RICPLT_NAMESPACE" |grep -v "tiller" |grep -v "RESTARTS" |grep -v "robot")
39 #while [ ! -z "$RES" ]; do
40 #  NUMPODS=$(echo "$RES" | wc -l)
41 #  echo "$(( NUMPODS - 1 )) pod(s) left, check again in 5 seconds ..."
42 #  sleep 5
43 #  RES=$(kubectl get pods -n "$RICPLT_NAMESPACE" |grep -v "tiller" |grep -v "RESTARTS" |grep -v "robot")
44 #done
45 #echo "All RIC resources are gone."
46 #./helm_reset.sh
47
48 echo "It may take Kubernetes some time to release all resources created"
49 echo "for RIC Platform.  Use \"kubectl get pods -n ricplatform\" to check."
50 echo "To truely clean up the helm state, run the following command:"
51 echo " ./helm_reset.sh"
52 echo "Done"