X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=smo-install%2Fscripts%2Fsub-scripts%2Funinstall-nonrtric.sh;h=6c528e3f7d157a99b071e3505c02225e2d4037e9;hb=HEAD;hp=61a87e71ce4ac424fbee85dcba7566d216e909b6;hpb=a2c2df5014145ee3126146987d9039e397b12407;p=it%2Fdep.git diff --git a/smo-install/scripts/sub-scripts/uninstall-nonrtric.sh b/smo-install/scripts/sub-scripts/uninstall-nonrtric.sh index 61a87e71..ee52b7ca 100755 --- a/smo-install/scripts/sub-scripts/uninstall-nonrtric.sh +++ b/smo-install/scripts/sub-scripts/uninstall-nonrtric.sh @@ -1,12 +1,13 @@ #!/bin/bash ### -# ============LICENSE_START======================================================= +# ============LICENSE_START======================================================== # ORAN SMO Package -# ================================================================================ +# ================================================================================= # Copyright (C) 2021 AT&T Intellectual Property. All rights # reserved. -# ================================================================================ +# Modification 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. # You may obtain a copy of the License at @@ -18,11 +19,34 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# ============LICENSE_END============================================ -# =================================================================== -# +# ============LICENSE_END========================================================== +# ================================================================================= +# ### +if ! jq --version > /dev/null 2>&1 ; then + sudo apt-get update + sudo apt-get install -y jq +fi + +INSTALL_KONG=$(helm get values oran-nonrtric -n nonrtric -o json | jq '.nonrtric.installKong') +if [ $? -ne 0 ]; then + echo "Failed to parse helm release value installKong with jq." + exit 1 +fi + +if [ "$INSTALL_KONG" = true ];then + echo "Warning - deleting Kong routes and services for ServiceManager." + SERVICEMANAGER_POD=$(kubectl get pods -o custom-columns=NAME:.metadata.name -l app.kubernetes.io/name=servicemanager --no-headers -n nonrtric) + if [[ -n $SERVICEMANAGER_POD ]]; then + kubectl exec $SERVICEMANAGER_POD -n nonrtric -- ./kongclearup + else + echo "Error - Servicemanager pod not found, didn't delete Kong routes and services for ServiceManager." + fi +fi + kubectl delete namespace nonrtric kubectl delete pv nonrtric-pv2 kubectl delete pv nonrtric-pv1 +kubectl delete pv nonrtric-pv3 +kubectl get pv | grep Released | awk '$1 {print$1}' | while read vol; do kubectl delete pv/${vol}; done