+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
+