X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=bin%2Fdeploy-nonrtric;h=e0c3306047a6f3d688df9db529b93be0a09c5869;hb=refs%2Fchanges%2F41%2F12941%2F3;hp=2125ef31b39d4131410f7fd7443b98fbe983710c;hpb=de740b72dc299a2b874ecbeba3d9a2a66bfdc904;p=it%2Fdep.git diff --git a/bin/deploy-nonrtric b/bin/deploy-nonrtric index 2125ef31..e0c33060 100755 --- a/bin/deploy-nonrtric +++ b/bin/deploy-nonrtric @@ -50,6 +50,39 @@ if [ -z "$OVERRIDEYAML" ];then exit 1 fi +if ! command -v yq > /dev/null 2>&1; then + echo "yq is not installed. Installing yq..." + sudo snap install yq --channel=v3/stable +fi + +INSTALL_KONG=$(yq read "$OVERRIDEYAML" 'nonrtric.installKong') +if [ $? -ne 0 ] || [ -z "$INSTALL_KONG" ]; then + echo "Error: failed to parse installKong from YAML with yq. Aborting install." + exit 1 +fi + +INSTALL_CAPIF=$(yq read "$OVERRIDEYAML" 'nonrtric.installCapifcore') +if [ $? -ne 0 ] || [ -z "$INSTALL_CAPIF" ]; then + echo "Error: failed to parse installCapifcore from YAML with yq. Aborting install." + exit 1 +fi + +INSTALL_SERVICEMANAGER=$(yq read "$OVERRIDEYAML" 'nonrtric.installServicemanager') +if [ $? -ne 0 ] || [ -z "$INSTALL_SERVICEMANAGER" ]; then + echo "Error: failed to parse installServicemanager from YAML with yq. Aborting install." + exit 1 +fi + +if [ "$INSTALL_SERVICEMANAGER" == "true" ]; then + if [ "$INSTALL_KONG" == "false" ]; then + echo "Error: INSTALL_KONG must be true if INSTALL_SERVICEMANAGER is true. Aborting install." + exit 1 + fi + if [ "$INSTALL_CAPIF" == "false" ]; then + echo "Error: INSTALL_CAPIF must be true if INSTALL_SERVICEMANAGER is true. Aborting install." + exit 1 + fi +fi ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" @@ -168,7 +201,6 @@ COMMON_BLOCK=$(cat $OVERRIDEYAML | awk '/^common:/{getline; while ($0 ~ /^ +.*|^ 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_KONG=$(cat $OVERRIDEYAML | awk '/^ installKong:/{print $2}') INSTALL_RANPM=$(cat $OVERRIDEYAML | awk '/^ installRanpm:/{print $2}') if ! kubectl get ns ${NONRTRIC_NAMESPACE:-nonrtric}> /dev/null 2>&1; then @@ -193,7 +225,7 @@ if [ "$INSTALL_KONG" = true ];then echo "Installing Kong" helm repo add kong https://charts.konghq.com --force-update helm repo update - helm install kong-nonrtric kong/kong -n ${NONRTRIC_NAMESPACE:-nonrtric} -f dep/nonrtric/helm/kongstorage/kongvalues.yaml + helm install oran-nonrtric kong/kong -n ${NONRTRIC_NAMESPACE:-nonrtric} -f dep/nonrtric/helm/kongstorage/kongvalues.yaml fi kubectl create configmap -n ${NONRTRIC_NAMESPACE:-nonrtric} nonrtric-recipe --from-file=recipe=$OVERRIDEYAML