+COMMON_BLOCK=$(cat $OVERRIDEYAML | awk '/^common:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}')
+NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}')
+NONRTRIC_NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *nonrtric:/{print $2}')
+RELEASE_PREFIX=$(echo "$COMMON_BLOCK" | awk '/^ *releasePrefix:/{print $2}')
+INSTALL_RANPM=$(cat $OVERRIDEYAML | awk '/^ installRanpm:/{print $2}')
+
+if ! kubectl get ns ${NONRTRIC_NAMESPACE:-nonrtric}> /dev/null 2>&1; then
+ kubectl create ns ${NONRTRIC_NAMESPACE:-nonrtric}
+fi
+
+if ! kubectl get ns onap > /dev/null 2>&1; then
+ kubectl create ns onap
+fi
+
+HELM_NAME_OPT=""
+if [ -z $IS_HELM3 ];then
+ HELM_NAME_OPT="--name"
+fi
+
+echo "Install Kong- $INSTALL_KONG"
+
+if [ "$INSTALL_KONG" = true ];then
+ DEFAULT_SC=$(kubectl get sc -o jsonpath='{.items[?(@.metadata.annotations.storageclass\.kubernetes\.io/is-default-class=="true")].metadata.name}')
+ if [ -z "$DEFAULT_SC" ];then
+ echo "----------------------------------- WARNING!!! -------------------------------------------------------"
+ echo "Default storage class is not set."
+ echo "Kong PV and PVC creation may fail if it unable to create/use a storage class."
+ echo "Storage class for the kong installation can be specified in nonrtric/helm/kongstorage/kongvalues.yaml"
+ echo "------------------------------------------------------------------------------------------------------"
+ else
+ echo "Default storage class is set to $DEFAULT_SC"
+ fi
+
+ echo "Install kongstorage through helm"
+ helm install kongstorage -n "${NONRTRIC_NAMESPACE:-nonrtric}" ${HELM_NAME_OPT} "$ROOT_DIR/../nonrtric/helm/kongstorage"
+
+ echo "Installing Kong"
+ helm repo add kong https://charts.konghq.com --force-update
+ helm repo update
+ helm install oran-nonrtric kong/kong -n ${NONRTRIC_NAMESPACE:-nonrtric} -f "$ROOT_DIR/../nonrtric/helm/kongstorage/kongvalues.yaml"
+fi
+
+kubectl create configmap -n ${NONRTRIC_NAMESPACE:-nonrtric} nonrtric-recipe --from-file=recipe=$OVERRIDEYAML
+
+echo "Deploying NONRTRIC"
+
+echo "Install Ranpm- $INSTALL_RANPM"
+
+if [ "$INSTALL_RANPM" = true ];then
+ echo "Running install-ranpm.sh"
+ chmod +x ${ROOT_DIR}/../ranpm/install/install-ranpm.sh
+ ${ROOT_DIR}/../ranpm/install/install-ranpm.sh
+ echo "install-ranpm.sh completed"
+fi
+
+echo "helm install -f $OVERRIDEYAML --namespace ${NONRTRIC_NAMESPACE:-nonrtric} ${HELM_NAME_OPT} ${RELEASE_PREFIX} $ROOT_DIR/../nonrtric/helm/nonrtric"
+helm install -f $OVERRIDEYAML -n "${NONRTRIC_NAMESPACE:-nonrtric}" ${HELM_NAME_OPT} "${RELEASE_PREFIX}" "$ROOT_DIR/../nonrtric/helm/nonrtric"
+
+if [ "$INSTALL_SERVICEMANAGER" == "true" ]; then
+ pushd "$ROOT_DIR/../nonrtric/servicemanager-preload"
+ # Send stderr to null to turn off chatty logging
+ ./servicemanager-preload.sh config-nonrtric.yaml 2>/dev/null
+ popd
+fi