Updating the G release recipe
[ric-plt/ric-dep.git] / bin / uninstall
index 9f4f385..f065fe8 100755 (executable)
@@ -2,6 +2,7 @@
 ################################################################################
 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
 #   Copyright (c) 2019 Nokia.                                                  #
+#   Copyright (c) 2021 HCL Technologies Limited.                               #
 #                                                                              #
 #   Licensed under the Apache License, Version 2.0 (the "License");            #
 #   you may not use this file except in compliance with the License.           #
@@ -16,7 +17,7 @@
 #   limitations under the License.                                             #
 ################################################################################
 
-COMPONENTS="xapp-onboarder appmgr rtmgr dbaas1 dbaasha e2mgr e2term a1mediator submgr vespamgr jaegeradapter infrastructure o1mediator"
+COMPONENTS="xapp-onboarder appmgr rtmgr e2mgr e2term a1mediator submgr vespamgr jaegeradapter dbaas infrastructure o1mediator alarmmanager influxdb"
 RECIPE_NAMESPACE=$(kubectl get cm --all-namespaces | grep ricplt-recipe | awk '{print $1}')
 kubectl get configmap  -n $RECIPE_NAMESPACE ricplt-recipe  -o jsonpath='{.data.recipe}' > /tmp/recipe.yaml
 
@@ -32,12 +33,22 @@ INFRANAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *infra:/{print $2}')
 XAPPNAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *xapp:/{print $2}')
 RELEASE_PREFIX=$(echo "$COMMON_BLOCK" | awk '/^ *releasePrefix:/{print $2}')
 
+IS_HELM3=$(helm version --short|grep -e "^v3")
 
 echo "Undeploying RIC platform components [$COMPONENTS]"
 
 
+HELM_FLAG=''
+if [ $IS_HELM3 ]
+then 
+  HELM_FLAG=' -n '${PLTNAMESPACE:-ricplt}
+else
+  HELM_FLAG='--purge'
+fi
+
+
 for component in $COMPONENTS; do
-    helm delete --purge ${RELEASE_PREFIX}-$component
+    helm delete $HELM_FLAG ${RELEASE_PREFIX}-$component
 done
 
 kubectl delete cm -n ${PLTNAMESPACE:-ricplt} ricplt-recipe