X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=bin%2Fundeploy-nonrtric;h=af9a31db4976108c096e79dc97065c4b17390b13;hb=d477ffdd450fa71dc8e8705f859b8520a59b1803;hp=6b7188781ac611dacae8d49ff0e43476f7ccafe7;hpb=538db334410daa7980de36b5632aa90c8e863d8e;p=it%2Fdep.git diff --git a/bin/undeploy-nonrtric b/bin/undeploy-nonrtric index 6b718878..af9a31db 100755 --- a/bin/undeploy-nonrtric +++ b/bin/undeploy-nonrtric @@ -1,6 +1,7 @@ #!/bin/bash ################################################################################ # Copyright (c) 2023 Nordix Foundation. # +# Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved. # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -16,8 +17,29 @@ ################################################################################ # This script to undeploy the NONRTRIC +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +echo "** $ROOT_DIR" + +COMPONENTS=" +a1controller \ +a1simulator \ +capifcore \ +controlpanel \ +dmaapadapterservice \ +dmaapmediatorservice \ +dmeparticipant \ +helmmanager \ +informationservice \ +nonrtricgateway \ +orufhrecovery \ +policymanagementservice \ +ransliceassurance \ +rappcatalogueenhancedservice \ +rappcatalogueservice \ +rappmanager \ +servicemanager \ +" -COMPONENTS="controlpanel a1controller a1simulator policymanagementservice informationservice rappcatalogueservice rappcatalogueenhancedservice nonrtricgateway dmaapadapterservice dmaapmediatorservice helmmanager orufhrecovery ransliceassurance capifcore ranpm" RECIPE_NAMESPACE=$(kubectl get cm --all-namespaces | grep nonrtric-recipe | awk '{print $1}') kubectl get configmap -n $RECIPE_NAMESPACE nonrtric-recipe -o jsonpath='{.data.recipe}' > /tmp/recipe.yaml @@ -34,8 +56,17 @@ INSTALL_KONG=$(cat /tmp/recipe.yaml | awk '/^ installKong:/{print $2}') INSTALL_RANPM=$(cat /tmp/recipe.yaml | awk '/^ installRanpm:/{print $2}') if [ "$INSTALL_KONG" = true ];then - echo "Uninstalling Kong" - helm delete kong-nonrtric --namespace kong + echo "Warning - deleting Kong routes and services for ServiceManager" + SERVICEMANAGER_POD=$(kubectl get pods -o custom-columns=NAME:.metadata.name -l app=nonrtric-servicemanager --no-headers -n ${NONRTRIC_NAMESPACE:-nonrtric}) + if [[ -n $SERVICEMANAGER_POD ]]; then + kubectl exec $SERVICEMANAGER_POD -n ${NONRTRIC_NAMESPACE:-nonrtric} -- ./kongclearup + else + echo "Error - Servicemanager pod not found, didn't delete Kong routes and services for ServiceManager" + fi + echo "Uninstalling kongstorage" + helm delete kongstorage -n "${NONRTRIC_NAMESPACE:-nonrtric}" + echo "Uninstalling Kong" + helm delete kong-nonrtric -n ${NONRTRIC_NAMESPACE:-nonrtric} fi ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" @@ -66,3 +97,14 @@ kubectl delete cm -n ${NONRTRIC_NAMESPACE:-nonrtric} nonrtric-recipe kubectl delete ns ${NONRTRIC_NAMESPACE:-nonrtric} kubectl delete ns onap + +# Cleanup ChartMuseum +CM_PID_FILE="$ROOT_DIR/CM_PID.txt" +if [ -f $CM_PID_FILE ]; then + echo "Cleaning up ChartMuseum..." + PID=$(cat "$CM_PID_FILE") + echo "Killing ChartMuseum with PID $PID" + kill $PID + rm $CM_PID_FILE + echo "ChartMuseum cleanup completed" +fi