2 ################################################################################
3 # Copyright (c) 2019 AT&T Intellectual Property. #
4 # Copyright (c) 2019 Nokia. #
5 # Copyright (c) 2021 HCL Technologies Limited. #
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 #
11 # http://www.apache.org/licenses/LICENSE-2.0 #
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 ################################################################################
20 COMPONENTS="xapp-onboarder appmgr rtmgr e2mgr e2term a1mediator submgr vespamgr jaegeradapter dbaas infrastructure o1mediator alarmmanager influxdb"
21 RECIPE_NAMESPACE=$(kubectl get cm --all-namespaces | grep ricplt-recipe | awk '{print $1}')
22 kubectl get configmap -n $RECIPE_NAMESPACE ricplt-recipe -o jsonpath='{.data.recipe}' > /tmp/recipe.yaml
24 if [ ! -s /tmp/recipe.yaml ]; then
25 echo "RICPLT recipe is not found. Are you sure the ric platform is deployed successfully?"
29 COMMON_BLOCK=$(cat /tmp/recipe.yaml | awk '/^common:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}')
30 NAMESPACE_BLOCK=$(cat /tmp/recipe.yaml | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}')
31 PLTNAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *platform:/{print $2}')
32 INFRANAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *infra:/{print $2}')
33 XAPPNAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *xapp:/{print $2}')
34 RELEASE_PREFIX=$(echo "$COMMON_BLOCK" | awk '/^ *releasePrefix:/{print $2}')
36 IS_HELM3=$(helm version --short|grep -e "^v3")
38 echo "Undeploying RIC platform components [$COMPONENTS]"
44 HELM_FLAG=' -n '${PLTNAMESPACE:-ricplt}
50 for component in $COMPONENTS; do
51 helm delete $HELM_FLAG ${RELEASE_PREFIX}-$component
54 kubectl delete cm -n ${PLTNAMESPACE:-ricplt} ricplt-recipe
56 kubectl delete ns ${XAPPNAMESPACE:-ricxapp}
57 kubectl delete ns ${INFRANAMESPACE:-ricinfra}
58 kubectl delete ns ${PLTNAMESPACE:-ricplt}