blob: ee52b7cac759cae671ab701dfa20a5359981584d [file] [log] [blame]
sebdeta2c2df52021-10-15 13:47:31 +02001#!/bin/bash
2
3###
DenisGNoonan3fdbdbb2024-05-16 10:49:21 +01004# ============LICENSE_START========================================================
sebdeta2c2df52021-10-15 13:47:31 +02005# ORAN SMO Package
DenisGNoonan3fdbdbb2024-05-16 10:49:21 +01006# =================================================================================
sebdeta2c2df52021-10-15 13:47:31 +02007# Copyright (C) 2021 AT&T Intellectual Property. All rights
8# reserved.
DenisGNoonan3fdbdbb2024-05-16 10:49:21 +01009# Modification Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
10# =================================================================================
sebdeta2c2df52021-10-15 13:47:31 +020011# Licensed under the Apache License, Version 2.0 (the "License");
12# you may not use this file except in compliance with the License.
13# You may obtain a copy of the License at
14#
15# http://www.apache.org/licenses/LICENSE-2.0
16#
17# Unless required by applicable law or agreed to in writing, software
18# distributed under the License is distributed on an "AS IS" BASIS,
19# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20# See the License for the specific language governing permissions and
21# limitations under the License.
DenisGNoonan3fdbdbb2024-05-16 10:49:21 +010022# ============LICENSE_END==========================================================
23# =================================================================================
24#
sebdeta2c2df52021-10-15 13:47:31 +020025###
26
DenisGNoonan3fdbdbb2024-05-16 10:49:21 +010027if ! jq --version > /dev/null 2>&1 ; then
28 sudo apt-get update
29 sudo apt-get install -y jq
30fi
31
32INSTALL_KONG=$(helm get values oran-nonrtric -n nonrtric -o json | jq '.nonrtric.installKong')
33if [ $? -ne 0 ]; then
34 echo "Failed to parse helm release value installKong with jq."
35 exit 1
36fi
37
38if [ "$INSTALL_KONG" = true ];then
39 echo "Warning - deleting Kong routes and services for ServiceManager."
40 SERVICEMANAGER_POD=$(kubectl get pods -o custom-columns=NAME:.metadata.name -l app.kubernetes.io/name=servicemanager --no-headers -n nonrtric)
41 if [[ -n $SERVICEMANAGER_POD ]]; then
42 kubectl exec $SERVICEMANAGER_POD -n nonrtric -- ./kongclearup
43 else
44 echo "Error - Servicemanager pod not found, didn't delete Kong routes and services for ServiceManager."
45 fi
46fi
47
sebdeta2c2df52021-10-15 13:47:31 +020048kubectl delete namespace nonrtric
49kubectl delete pv nonrtric-pv2
50kubectl delete pv nonrtric-pv1
sebdet11f85c72021-12-17 18:27:29 +010051kubectl delete pv nonrtric-pv3
sebdetdd88f8e2022-03-03 23:27:08 +010052kubectl get pv | grep Released | awk '$1 {print$1}' | while read vol; do kubectl delete pv/${vol}; done