From: Zhe Huang Date: Mon, 9 Sep 2019 20:56:35 +0000 (-0400) Subject: Consolidate configurations to recipes. Add 5 second delay for Kong deployment due... X-Git-Tag: 0.0.2~11 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=9c381477a3319e5dff968b1a4e8566c71499b3b6;p=it%2Fdep.git Consolidate configurations to recipes. Add 5 second delay for Kong deployment due to slow API server in REC Signed-off-by: Zhe Huang Change-Id: I0f63bd7c4f95760a8a37835fa37ed691641b721b --- diff --git a/RECIPE_EXAMPLE/RIC_AUX_RECIPE_EXAMPLE b/RECIPE_EXAMPLE/RIC_AUX_RECIPE_EXAMPLE index a6b11f47..d2249c80 100644 --- a/RECIPE_EXAMPLE/RIC_AUX_RECIPE_EXAMPLE +++ b/RECIPE_EXAMPLE/RIC_AUX_RECIPE_EXAMPLE @@ -19,6 +19,12 @@ # Global common setting #------------------------------------------------------------------------- global: + releasePrefix: r1 + namespace: + xapp: ricxapp + infra: ricinfra + platform: ricplt + aux: ricaux # Docker registry from which RIC platform components pull the images repository: nexus3.o-ran-sc.org:10004 @@ -103,6 +109,7 @@ dashboard: # internal URL for backend ecomp_rest_url: http://portal-app.onap:8989/ONAPPORTAL/auxapi ueb_app_key: uebkey + datapath: /opt/data/dashboard-data extsvcaux: ricip: diff --git a/RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE b/RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE index 7a66bb11..8a06aed0 100644 --- a/RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE +++ b/RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE @@ -19,6 +19,13 @@ # Global common setting #------------------------------------------------------------------------- global: + releasePrefix: r1 + namespace: + xapp: ricxapp + + infra: ricinfra + platform: ricplt + aux: ricaux # Docker registry from which RIC platform components pull the images repository: nexus3.o-ran-sc.org:10004 @@ -83,12 +90,6 @@ global: # Infrastructure #------------------------------------------------------------------------- -cluster: - deployK8S: false - deployNexus: false - deployK8SMonitoringStack: false - useLocalHelmRepo: true - useLocalDockerRegistry: false credential: repositoryCredential: @@ -105,8 +106,11 @@ credential: -----END CERTIFICATE----- +k8s: + enable: false chartmuseum: + enable: false repositoryOverride: "docker.io" image: name: chartmuseum/chartmuseum @@ -115,5 +119,9 @@ chartmuseum: image: name: alpine tag: latest - storagesize: 2Gi + datapath: /opt/data/chartmuseum-data + +elfkp: + enable: false + diff --git a/RECIPE_EXAMPLE/RIC_PLATFORM_RECIPE_EXAMPLE b/RECIPE_EXAMPLE/RIC_PLATFORM_RECIPE_EXAMPLE index 0d9f1cc4..8b035999 100644 --- a/RECIPE_EXAMPLE/RIC_PLATFORM_RECIPE_EXAMPLE +++ b/RECIPE_EXAMPLE/RIC_PLATFORM_RECIPE_EXAMPLE @@ -19,6 +19,12 @@ # Global common setting #------------------------------------------------------------------------- global: + releasePrefix: r1 + namespace: + xapp: ricxapp + infra: ricinfra + platform: ricplt + aux: ricaux # Docker registry from which RIC platform components pull the images repository: nexus3.o-ran-sc.org:10004 diff --git a/bin/clean-up-aux b/bin/clean-up-aux deleted file mode 100755 index e36393b5..00000000 --- a/bin/clean-up-aux +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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 # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# 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. # -################################################################################ - -# This script clean up the PV data for aux cluster - -rm -rf /opt/data/dashboard-data -rm -rf /opt/data/chartmuseum-data diff --git a/bin/deploy-ric-aux b/bin/deploy-ric-aux index 8a4546fb..c517862d 100755 --- a/bin/deploy-ric-aux +++ b/bin/deploy-ric-aux @@ -18,33 +18,42 @@ # This script deploys RIC aux components automatically -OVERRIDEYAML=$1 +if [ "$#" -eq 1 ]; then + OVERRIDEYAML=$1 +else -if [ -z "$OVERRIDEYAML" ];then -echo "****************************************************************************************************************" -echo " WARNING " -echo "****************************************************************************************************************" -echo "Deploying RIC auxiliary without deployment recipe. Default configurations are used." -echo "****************************************************************************************************************" + while [ -n "$1" ]; do # while loop starts -fi + case "$1" in + -f) OVERRIDEYAML=$2 + shift + ;; + *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c -ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + esac -source $ROOT_DIR/../etc/ric.conf + shift + done +fi -export RICAUX_RELEASE_NAME=$helm_release_name -export RICPLT_NAMESPACE=$plt_namespace -export RICXAPP_NAMESPACE=$xapp_namespace -export RICAUX_NAMESPACE=$aux_namespace -export RICINFRA_NAMESPACE=$infra_namespace +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option." + echo "****************************************************************************************************************" + exit 1 +fi + + +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" for component in $ROOT_DIR/../ric-aux/*/; do # Will print */ if no directories are available - . $component/bin/install $OVERRIDEYAML + . $component/bin/install -f $OVERRIDEYAML done diff --git a/bin/deploy-ric-infra b/bin/deploy-ric-infra index cc36c683..a5cb94be 100755 --- a/bin/deploy-ric-infra +++ b/bin/deploy-ric-infra @@ -16,84 +16,48 @@ # limitations under the License. # ################################################################################ -# This script deploys RIC platform components automatically - -OVERRIDEYAML=$1 - -if [ -z "$OVERRIDEYAML" ];then -echo "****************************************************************************************************************" -echo " WARNING " -echo "****************************************************************************************************************" -echo "Preparing the clusters for RIC deployment without deployment recipe. Default configurations are used." -echo "****************************************************************************************************************" - - -fi - - -ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" - -source $ROOT_DIR/../etc/ric.conf -source $ROOT_DIR/../etc/ric-infra.conf +if [ "$#" -eq 1 ]; then + OVERRIDEYAML=$1 +else + while [ -n "$1" ]; do # while loop starts -export RICINFRA_RELEASE_NAME=$helm_release_name + case "$1" in -export RICPLT_NAMESPACE=$plt_namespace -export RICXAPP_NAMESPACE=$xapp_namespace -export RICAUX_NAMESPACE=$aux_namespace -export RICINFRA_NAMESPACE=$infra_namespace + -f) OVERRIDEYAML=$2 + shift + ;; + *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c + esac -if [ ! -z $OVERRIDEYAML ]; then - DEPLOY_K8S_FROM_OVERRIDE=$(cat $OVERRIDEYAML | grep deployK8S: | awk '{print $2}') - USE_LOCAL_HELM_REPO_FROM_OVERRIDE=$(cat $OVERRIDEYAML | grep useLocalHelmRepo: | awk '{print $2}') - USE_LOCAL_DOCKER_REGISTRY_FROM_OVERRIDE=$(cat $OVERRIDEYAML | grep useLocalDockerRegistry: | awk '{print $2}') - DEPLOY_K8S_MONITORING_FROM_OVERRIDE=$(cat $OVERRIDEYAML | grep deployK8SMonitoringStake: | awk '{print $2}') -fi + shift -if [ -z $DEPLOY_K8S_FROM_OVERRIDE ]; then - export DEPLOY_K8S=$deployK8S -else - export DEPLOY_K8S=$DEPLOY_K8S_FROM_OVERRIDE + done fi -if [ -z $USE_LOCAL_HELM_REPO_FROM_OVERRIDE ]; then - export USE_LOCAL_HELM_REPO=$useLocalHelmRepo -else - export USE_LOCAL_HELM_REPO=$USE_LOCAL_HELM_REPO_FROM_OVERRIDE -fi -if [ -z $USE_LOCAL_DOCKER_REGISTRY_FROM_OVERRIDE ]; then - export USE_LOCAL_DOCKER_REGISTRY=$useLocalDockerRegistry -else - export USE_LOCAL_DOCKER_REGISTRY=$USE_LOCAL_DOCKER_REGISTRY_FROM_OVERRIDE -fi -if [ -z $DEPLOY_K8S_MONITORING_FROM_OVERRIDE ]; then - export DEPLOY_K8S_MONITORING=$deployK8S -else - export DEPLOY_K8S_MONITORING=$DEPLOY_K8S_MONITORING_FROM_OVERRIDE +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option." + echo "****************************************************************************************************************" + exit 1 fi -if ! $USE_LOCAL_HELM_REPO; then - echo "****************************************************************************************************************" - echo " WARNING " - echo "****************************************************************************************************************" - echo "RIC will use an external helm repository. Please make sure that the certificate is included in the recipe file." - echo "****************************************************************************************************************" -fi +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" -if $USE_LOCAL_DOCKER_REGISTRY; then - echo "****************************************************************************************************************" - echo " WARNING " - echo "****************************************************************************************************************" - echo "RIC will use an internal docker registry. You need to manually include the certificate to all servers in the cluster." - echo "****************************************************************************************************************" -fi +CHARTMUSEUM_BLOCK=$(cat $OVERRIDEYAML | awk '/^chartmuseum:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}') +ELFKP_BLOCK=$(cat $OVERRIDEYAML | awk '/^elfkp:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}') +K8S_BLOCK=$(cat $OVERRIDEYAML | awk '/^k8s:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}') +USE_LOCAL_HELM_REPO=$(echo "$CHARTMUSEUM_BLOCK" | grep "enable" | awk '{print $2}') +DEPLOY_K8S=$(echo "$K8S_BLOCK" | grep "enable" | awk '{print $2}') +DEPLOY_K8S_MONITORING=$(echo "$ELFKP_BLOCK" | grep "enable" | awk '{print $2}') for component in $ROOT_DIR/../ric-infra/*/; do @@ -101,27 +65,26 @@ for component in $ROOT_DIR/../ric-infra/*/; do case "$component_name" in 00-Kubernetes) - if $DEPLOY_K8S; then - . $component/bin/install $OVERRIDEYAM - fi - ;; - 10-Nexus) - if $USE_LOCAL_DOCKER_REGISTRY; then - . $component/bin/install $OVERRIDEYAM + if [ "$DEPLOY_K8S" == "true" ];then + . $component/bin/install -f $OVERRIDEYAML fi ;; 15-Chartmuseum) - if $USE_LOCAL_HELM_REPO; then - . $component/bin/install $OVERRIDEYAM + if [ "$USE_LOCAL_HELM_REPO" == "true" ];then + . $component/bin/install -f $OVERRIDEYAML fi ;; 20-Monitoring) - if $DEPLOY_K8S_MONITORING; then - . $component/bin/install $OVERRIDEYAM + if [ "$DEPLOY_K8S_MONITORING" == "true" ];then + . $component/bin/install -f $OVERRIDEYAML fi ;; + 30-Kong) + . $component/bin/install -f $OVERRIDEYAML + sleep 5 + ;; *) - . $component/bin/install $OVERRIDEYAM + . $component/bin/install -f $OVERRIDEYAML esac done diff --git a/bin/deploy-ric-platform b/bin/deploy-ric-platform index b19a4711..0826ba6a 100755 --- a/bin/deploy-ric-platform +++ b/bin/deploy-ric-platform @@ -18,34 +18,43 @@ # This script deploys RIC platform components automatically -OVERRIDEYAML=$1 +if [ "$#" -eq 1 ]; then + OVERRIDEYAML=$1 +else -if [ -z "$OVERRIDEYAML" ];then -echo "****************************************************************************************************************" -echo " WARNING " -echo "****************************************************************************************************************" -echo "Deploying RIC platform without deployment recipe. Default configurations are used." -echo "****************************************************************************************************************" + while [ -n "$1" ]; do # while loop starts + case "$1" in -fi + -f) OVERRIDEYAML=$2 + shift + ;; + *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c + esac -ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + shift -source $ROOT_DIR/../etc/ric.conf + done +fi -export RICPLT_RELEASE_NAME=$helm_release_name +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option." + echo "****************************************************************************************************************" + exit 1 +fi + -export RICPLT_NAMESPACE=$plt_namespace -export RICXAPP_NAMESPACE=$xapp_namespace -export RICAUX_NAMESPACE=$aux_namespace -export RICINFRA_NAMESPACE=$infra_namespace + +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" for component in $ROOT_DIR/../ric-platform/*/; do # Will print */ if no directories are available - . $component/bin/install $OVERRIDEYAML + . $component/bin/install -f $OVERRIDEYAML done diff --git a/bin/undeploy-ric-aux b/bin/undeploy-ric-aux index 735dfbf1..1fa96dcf 100755 --- a/bin/undeploy-ric-aux +++ b/bin/undeploy-ric-aux @@ -21,12 +21,6 @@ ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" -source $ROOT_DIR/../etc/ric.conf - -export RICAUX_RELEASE_NAME=$helm_release_name - -export RICAUX_NAMESPACE=$aux_namespace - for component in $ROOT_DIR/../ric-aux/*/; do # Will print */ if no directories are available diff --git a/bin/undeploy-ric-infra b/bin/undeploy-ric-infra index ea8ab359..9b2f53df 100755 --- a/bin/undeploy-ric-infra +++ b/bin/undeploy-ric-infra @@ -21,17 +21,6 @@ ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" -source $ROOT_DIR/../etc/ric.conf -source $ROOT_DIR/../etc/ric-infra.conf - - -export RICINFRA_RELEASE_NAME=$helm_release_name - -export RICPLT_NAMESPACE=$plt_namespace -export RICXAPP_NAMESPACE=$xapp_namespace -export RICAUX_NAMESPACE=$aux_namespace -export RICINFRA_NAMESPACE=$infra_namespace - for component in $ROOT_DIR/../ric-infra/*/; do # Will print */ if no directories are available diff --git a/bin/undeploy-ric-platform b/bin/undeploy-ric-platform index adeea6a0..574baaeb 100755 --- a/bin/undeploy-ric-platform +++ b/bin/undeploy-ric-platform @@ -21,12 +21,6 @@ ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" -source $ROOT_DIR/../etc/ric.conf - -export RICPLT_RELEASE_NAME=$helm_release_name - -export RICPLT_NAMESPACE=$plt_namespace - for component in $ROOT_DIR/../ric-platform/*/; do # Will print */ if no directories are available diff --git a/etc/ric-infra.conf b/etc/ric-infra.conf deleted file mode 100644 index a442a8f3..00000000 --- a/etc/ric-infra.conf +++ /dev/null @@ -1,27 +0,0 @@ -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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 # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# 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. # -################################################################################ - - - -# deploy the kubernete cluster -deployK8S=false - -# use the local helm repo -useLocalHelmRepo=true - -# use the local docker registry -useLocalDockerRegistry=true diff --git a/ric-aux/80-Auxiliary-Functions/bin/install b/ric-aux/80-Auxiliary-Functions/bin/install index 0d843733..916e067a 100755 --- a/ric-aux/80-Auxiliary-Functions/bin/install +++ b/ric-aux/80-Auxiliary-Functions/bin/install @@ -17,48 +17,41 @@ ################################################################################ -OVERRIDEYAML=$1 +while [ -n "$1" ]; do # while loop starts + case "$1" in -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + -f) OVERRIDEYAML=$2 + shift + ;; + -c) LIST_OF_COMPONENTS=$2 + shift + ;; + *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c + esac -source $DIR/../etc/aux.conf + shift -if [ -z "$RICAUX_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICAUX_RELEASE_NAME -fi +done -# Namespace configuration -if [ -z "$RICPLT_NAMESPACE" ];then - PLT_NAMESPACE=$plt_namespace -else - PLT_NAMESPACE=$RICPLT_NAMESPACE -fi -if [ -z "$RICXAPP_NAMESPACE" ];then - XAPP_NAMESPACE=$xapp_namespace -else - XAPP_NAMESPACE=$RICXAPP_NAMESPACE -fi -if [ -z "$RICAUX_NAMESPACE" ];then - AUX_NAMESPACE=$aux_namespace -else - AUX_NAMESPACE=$RICAUX_NAMESPACE -fi -if [ -z "$RICINFRA_NAMESPACE" ];then - INFRA_NAMESPACE=$infra_namespace -else - INFRA_NAMESPACE=$RICINFRA_NAMESPACE -fi -if [ -z "$RIC_COMMON_OVERRIDE" ];then - COMMON_OVERRIDE="--set global.namespace.platform=$PLT_NAMESPACE --set global.namespace.xapp=$XAPP_NAMESPACE --set global.namespace.aux=$AUX_NAMESPACE --set global.namespace.infra=$INFRA_NAMESPACE" -else - COMMON_OVERRIDE=$RIC_COMMON_OVERRIDE +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option." + echo "****************************************************************************************************************" + exit 1 fi +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +GLOBAL_BLOCK=$(cat $OVERRIDEYAML | awk '/^global:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *aux:/{print $2}') +RELEASE_PREFIX=$(echo "$GLOBAL_BLOCK" | awk '/^ *releasePrefix:/{print $2}') +COMPONENTS=${LIST_OF_COMPONENTS:-"dashboard ves message-router mrsub"} + NODENAME=$(kubectl get node | awk '{print $1}') @@ -70,10 +63,7 @@ for f in $NODENAME; do fi done -if [ ! -z $OVERRIDEYAML ]; then - FOUND_STORAGECLASS=$(grep storageclass $OVERRIDEYAML) -fi - +FOUND_STORAGECLASS=$(grep storageclass $OVERRIDEYAML) if ! $LABELFOUND && [ -z "$FOUND_STORAGECLASS" ]; then @@ -85,12 +75,10 @@ if ! $LABELFOUND && [ -z "$FOUND_STORAGECLASS" ]; then echo "* kubectl label --overwrite nodes local-storage=enable *" echo "***********************************************************************************************" - exit 1 + exit 1 fi - - if [ -z "$FOUND_STORAGECLASS" ] && $LABELFOUND; then DATAPATH=$(cat $DIR/../helm/dashboard/values.yaml | grep datapath | awk '{ print $2}' ) @@ -104,44 +92,36 @@ if [ -z "$FOUND_STORAGECLASS" ] && $LABELFOUND; then DATAPATH=$DATAPATHOVERRIDE fi + if [ ! -d "$DATAPATH" ]; then + mkdir -p $DATAPATH || { echo "Directory $DATAPATH does not exist and you don't have permission to create it. Please choose a different datapath." ; exit 1 ; } + fi echo "***********************************************************************************************" echo "* WARNING!!!!!!!!!!!!! *" echo "***********************************************************************************************" - echo "* Chartmuseume will use local storage. Please make sure that directory *" + echo "* Dashboard will use local storage. Please make sure that directory *" echo "* $DATAPATH *" - echo "* exists on the selected cluster node, and contains the proper files. *" + echo "* contains the proper files. *" echo "***********************************************************************************************" - fi - - - - - - -RICAUX_COMPONENTS="dashboard mrsub ves message-router" - -echo "Deploying RIC AUX components [$RICAUX_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" - +echo "Deploying RIC infra components [$COMPONENTS]" COMMON_CHART_VERSION=$(cat $DIR/../../../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}') - - -helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common/ - - -for component in $RICAUX_COMPONENTS; do - echo "Preparing chart for comonent $component" - - mkdir -p $DIR/../helm/$component/charts/ - cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/ - if [ -z $OVERRIDEYAML ]; then - helm install --namespace $AUX_NAMESPACE --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - else - helm install -f $OVERRIDEYAML --namespace $AUX_NAMESPACE --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - fi -done +helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common + + +for component in $COMPONENTS; do + case "$component" in + dashboard | ves | message-router | mrsub) + mkdir -p $DIR/../helm/$component/charts/ + cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/ + helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component + ;; + *) + helm install --namespace "${NAMESPACE}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component + + esac + +done \ No newline at end of file diff --git a/ric-aux/80-Auxiliary-Functions/bin/uninstall b/ric-aux/80-Auxiliary-Functions/bin/uninstall index 85d3b5c3..2f266912 100755 --- a/ric-aux/80-Auxiliary-Functions/bin/uninstall +++ b/ric-aux/80-Auxiliary-Functions/bin/uninstall @@ -17,26 +17,16 @@ ################################################################################ +COMPONENTS="dashboard message-router ves mrsub" +echo "Undeploying RIC aux components [$COMPONENTS]" -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" -source $DIR/../etc/aux.conf +for component in $COMPONENTS; do + RELEASE_LIST=$(helm list | grep "$component" | awk '{print $1}') + if [ ! -z "$RELEASE_LIST" ];then + helm delete --purge $RELEASE_LIST + fi -if [ -z "$RICAUX_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICAUX_RELEASE_NAME -fi - -RICAUX_COMPONENTS="dashboard message-router ves mrsub" - -echo "Undeploying RIC AUX components [$RICAUX_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" - - - -for component in $RICAUX_COMPONENTS; do - helm delete --purge "${RELEASE_NAME}-$component" done diff --git a/ric-aux/80-Auxiliary-Functions/etc/aux.conf b/ric-aux/80-Auxiliary-Functions/etc/aux.conf deleted file mode 100644 index 98680ed5..00000000 --- a/ric-aux/80-Auxiliary-Functions/etc/aux.conf +++ /dev/null @@ -1,37 +0,0 @@ -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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 # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# 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. # -################################################################################ - - -# helm_release_name defines the release name helm will use to deploy RIC -# It will be overrided by RICPLT_RELEASE_NAME -helm_release_name=r1 - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICPLT_NAMESPACE -plt_namespace=ricplt - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICXAPP_NAMESPACE -xapp_namespace=ricxapp - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICAUX_NAMESPACE -aux_namespace=onap - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICINFRA_NAMESPACE -infra_namespace=ricinfra diff --git a/ric-aux/85-Ext-Services/bin/install b/ric-aux/85-Ext-Services/bin/install index 59f01ca2..805950ee 100755 --- a/ric-aux/85-Ext-Services/bin/install +++ b/ric-aux/85-Ext-Services/bin/install @@ -16,66 +16,51 @@ # limitations under the License. # ################################################################################ +while [ -n "$1" ]; do # while loop starts -OVERRIDEYAML=$1 + case "$1" in + -f) OVERRIDEYAML=$2 + shift + ;; + -c) LIST_OF_COMPONENTS=$2 + shift + ;; + *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + esac -source $DIR/../etc/ext.conf + shift -if [ -z "$RICAUX_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICAUX_RELEASE_NAME -fi +done -# Namespace configuration -if [ -z "$RICPLT_NAMESPACE" ];then - PLT_NAMESPACE=$plt_namespace -else - PLT_NAMESPACE=$RICPLT_NAMESPACE -fi -if [ -z "$RICXAPP_NAMESPACE" ];then - XAPP_NAMESPACE=$xapp_namespace -else - XAPP_NAMESPACE=$RICXAPP_NAMESPACE -fi -if [ -z "$RICAUX_NAMESPACE" ];then - AUX_NAMESPACE=$aux_namespace -else - AUX_NAMESPACE=$RICAUX_NAMESPACE -fi -if [ -z "$RICINFRA_NAMESPACE" ];then - INFRA_NAMESPACE=$infra_namespace -else - INFRA_NAMESPACE=$RICINFRA_NAMESPACE -fi -if [ -z "$RIC_COMMON_OVERRIDE" ];then - COMMON_OVERRIDE="--set global.namespace.platform=$PLT_NAMESPACE --set global.namespace.xapp=$XAPP_NAMESPACE --set global.namespace.aux=$AUX_NAMESPACE --set global.namespace.infra=$INFRA_NAMESPACE" -else - COMMON_OVERRIDE=$RIC_COMMON_OVERRIDE +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option." + echo "****************************************************************************************************************" + exit 1 fi -RICAUX_COMPONENTS="extsvcaux" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +GLOBAL_BLOCK=$(cat $OVERRIDEYAML | awk '/^global:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *aux:/{print $2}') +RELEASE_PREFIX=$(echo "$GLOBAL_BLOCK" | awk '/^ *releasePrefix:/{print $2}') +COMPONENTS=${LIST_OF_COMPONENTS:-"extsvcaux"} -echo "Deploying RIC AUX components [$RICAUX_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" +echo "Deploying RIC infra components [$COMPONENTS]" COMMON_CHART_VERSION=$(cat $DIR/../../../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}') +helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common -helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common/ +for component in $COMPONENTS; do -for component in $RICAUX_COMPONENTS; do - echo "Preparing chart for comonent $component" - mkdir -p $DIR/../helm/$component/charts/ + mkdir -p $DIR/../helm/$component/charts/ cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/ - if [ -z $OVERRIDEYAML ]; then - helm install --debug --namespace $AUX_NAMESPACE --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - else - helm install -f $OVERRIDEYAML --namespace $AUX_NAMESPACE --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - fi + helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component done diff --git a/ric-aux/85-Ext-Services/bin/uninstall b/ric-aux/85-Ext-Services/bin/uninstall index ad8dac6e..02cee0ea 100755 --- a/ric-aux/85-Ext-Services/bin/uninstall +++ b/ric-aux/85-Ext-Services/bin/uninstall @@ -15,28 +15,16 @@ # See the License for the specific language governing permissions and # # limitations under the License. # ################################################################################ +COMPONENTS="extsvcaux" +echo "Undeploying RIC platform components [$COMPONENTS]" -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +for component in $COMPONENTS; do + RELEASE_LIST=$(helm list | grep "$component" | awk '{print $1}') + if [ ! -z "$RELEASE_LIST" ];then + helm delete --purge $RELEASE_LIST + fi - -source $DIR/../etc/ext.conf - -if [ -z "$RICAUX_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICAUX_RELEASE_NAME -fi - -RICAUX_COMPONENTS="extsvcaux" - -echo "Undeploying RIC AUX components [$RICAUX_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" - - - -for component in $RICAUX_COMPONENTS; do - helm delete --purge "${RELEASE_NAME}-$component" done diff --git a/ric-aux/85-Ext-Services/etc/ext.conf b/ric-aux/85-Ext-Services/etc/ext.conf deleted file mode 100644 index 92008b59..00000000 --- a/ric-aux/85-Ext-Services/etc/ext.conf +++ /dev/null @@ -1,37 +0,0 @@ -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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 # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# 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. # -################################################################################ - - -# helm_release_name defines the release name helm will use to deploy RIC -# It will be overrided by RICPLT_RELEASE_NAME -helm_release_name=r1 - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICPLT_NAMESPACE -plt_namespace=ricplt - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICXAPP_NAMESPACE -xapp_namespace=ricxapp - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICAUX_NAMESPACE -aux_namespace=ricaux - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICINFRA_NAMESPACE -infra_namespace=ricinfra diff --git a/ric-infra/15-Chartmuseum/bin/install b/ric-infra/15-Chartmuseum/bin/install index 6a6fe8c0..572ae3ee 100755 --- a/ric-infra/15-Chartmuseum/bin/install +++ b/ric-infra/15-Chartmuseum/bin/install @@ -17,49 +17,46 @@ ################################################################################ -OVERRIDEYAML=$1 +while [ -n "$1" ]; do # while loop starts + case "$1" in -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + -f) OVERRIDEYAML=$2 + shift + ;; + -c) LIST_OF_COMPONENTS=$2 + shift + ;; + *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c -source $DIR/../etc/chartmuseum.conf + esac -if [ -z "$RICINFRA_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICINFRA_RELEASE_NAME -fi -# Namespace configuration -if [ -z "$RICPLT_NAMESPACE" ];then - PLT_NAMESPACE=$plt_namespace -else - PLT_NAMESPACE=$RICPLT_NAMESPACE -fi -if [ -z "$RICXAPP_NAMESPACE" ];then - XAPP_NAMESPACE=$xapp_namespace -else - XAPP_NAMESPACE=$RICXAPP_NAMESPACE -fi -if [ -z "$RICAUX_NAMESPACE" ];then - AUX_NAMESPACE=$aux_namespace -else - AUX_NAMESPACE=$RICAUX_NAMESPACE -fi -if [ -z "$RICINFRA_NAMESPACE" ];then - INFRA_NAMESPACE=$infra_namespace -else - INFRA_NAMESPACE=$RICINFRA_NAMESPACE -fi + shift -if [ -z "$RIC_COMMON_OVERRIDE" ];then - COMMON_OVERRIDE="--set global.namespace.platform=$PLT_NAMESPACE --set global.namespace.xapp=$XAPP_NAMESPACE --set global.namespace.aux=$AUX_NAMESPACE --set global.namespace.infra=$INFRA_NAMESPACE" -else - COMMON_OVERRIDE=$RIC_COMMON_OVERRIDE +done + + +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option." + echo "****************************************************************************************************************" + exit 1 fi -NODENAME=$(kubectl get node | awk '{print $1}') +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +GLOBAL_BLOCK=$(cat $OVERRIDEYAML | awk '/^global:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *infra:/{print $2}') +RELEASE_PREFIX=$(echo "$GLOBAL_BLOCK" | awk '/^ *releasePrefix:/{print $2}') +COMPONENTS=${LIST_OF_COMPONENTS:-"chartmuseum"} + + +NODENAME=$(kubectl get node | awk 'NR>1{print $1}') + LABELFOUND=false for f in $NODENAME; do LABEL=$(kubectl describe node $f | grep local-storage) @@ -68,11 +65,7 @@ for f in $NODENAME; do fi done -if [ ! -z $OVERRIDEYAML ]; then - FOUND_STORAGECLASS=$(grep storageclass $OVERRIDEYAML) -fi - - +FOUND_STORAGECLASS=$(grep storageclass $OVERRIDEYAML) if ! $LABELFOUND && [ -z "$FOUND_STORAGECLASS" ]; then echo "***********************************************************************************************" @@ -83,12 +76,9 @@ if ! $LABELFOUND && [ -z "$FOUND_STORAGECLASS" ]; then echo "* kubectl label --overwrite nodes local-storage=enable *" echo "***********************************************************************************************" - exit 1 + exit 1 fi - - - if [ -z "$FOUND_STORAGECLASS" ] && $LABELFOUND; then DATAPATH=$(cat $DIR/../helm/chartmuseum/values.yaml | grep datapath | awk '{ print $2}' ) @@ -102,38 +92,29 @@ if [ -z "$FOUND_STORAGECLASS" ] && $LABELFOUND; then DATAPATH=$DATAPATHOVERRIDE fi + if [ ! -d "$DATAPATH" ]; then + mkdir -p $DATAPATH || { echo "Directory $DATAPATH does not exist and you don't have permission to create it. Please choose a different datapath." ; exit 1 ; } + fi echo "***********************************************************************************************" echo "* WARNING!!!!!!!!!!!!! *" echo "***********************************************************************************************" echo "* Chartmuseume will use local storage. Please make sure that directory *" echo "* $DATAPATH *" - echo "* exists on the selected cluster node, and contains the proper files. *" + echo "* contains the proper files. *" echo "***********************************************************************************************" - - fi -RICINFRA_COMPONENTS="chartmuseum" - -echo "Deploying RIC infra components [$RICINFRA_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" +echo "Deploying RIC infra components [$COMPONENTS]" COMMON_CHART_VERSION=$(cat $DIR/../../../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}') helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common - -for component in $RICINFRA_COMPONENTS; do +for component in $COMPONENTS; do mkdir -p $DIR/../helm/$component/charts/ - cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/ - - if [ -z $OVERRIDEYAML ]; then - helm install --debug --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - else - helm install -f $OVERRIDEYAML --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - fi + helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component done diff --git a/ric-infra/15-Chartmuseum/bin/uninstall b/ric-infra/15-Chartmuseum/bin/uninstall index 79ca2d7d..82d57a78 100755 --- a/ric-infra/15-Chartmuseum/bin/uninstall +++ b/ric-infra/15-Chartmuseum/bin/uninstall @@ -16,26 +16,15 @@ # limitations under the License. # ################################################################################ +COMPONENTS="chartmuseum" +echo "Undeploying RIC infra components [$COMPONENTS]" -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +for component in $COMPONENTS; do + RELEASE_LIST=$(helm list | grep "$component" | awk '{print $1}') + if [ ! -z "$RELEASE_LIST" ];then + helm delete --purge $RELEASE_LIST + fi - -source $DIR/../etc/chartmuseum.conf - -if [ -z "$RICINFRA_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICINFRA_RELEASE_NAME -fi - -RICINFRA_COMPONENTS="chartmuseum" - -echo "Undeploying RIC infra components [$RICINFRA_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" - - -for component in $RICINFRA_COMPONENTS; do - helm delete --purge "${RELEASE_NAME}-${component}" done diff --git a/ric-infra/15-Chartmuseum/etc/chartmuseum.conf b/ric-infra/15-Chartmuseum/etc/chartmuseum.conf deleted file mode 100644 index 92008b59..00000000 --- a/ric-infra/15-Chartmuseum/etc/chartmuseum.conf +++ /dev/null @@ -1,37 +0,0 @@ -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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 # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# 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. # -################################################################################ - - -# helm_release_name defines the release name helm will use to deploy RIC -# It will be overrided by RICPLT_RELEASE_NAME -helm_release_name=r1 - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICPLT_NAMESPACE -plt_namespace=ricplt - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICXAPP_NAMESPACE -xapp_namespace=ricxapp - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICAUX_NAMESPACE -aux_namespace=ricaux - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICINFRA_NAMESPACE -infra_namespace=ricinfra diff --git a/ric-infra/20-Monitoring/bin/install b/ric-infra/20-Monitoring/bin/install index 58274bfd..c2819ae6 100755 --- a/ric-infra/20-Monitoring/bin/install +++ b/ric-infra/20-Monitoring/bin/install @@ -15,64 +15,55 @@ # See the License for the specific language governing permissions and # # limitations under the License. # ################################################################################ +while [ -n "$1" ]; do # while loop starts + case "$1" in -OVERRIDEYAML=$1 + -f) OVERRIDEYAML=$2 + shift + ;; + -c) LIST_OF_COMPONENTS=$2 + shift + ;; + *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c + esac -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + shift -source $DIR/../etc/elfkp.conf +done -if [ -z "$RICINFRA_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICINFRA_RELEASE_NAME -fi -# Namespace configuration -if [ -z "$RICPLT_NAMESPACE" ];then - PLT_NAMESPACE=$plt_namespace -else - PLT_NAMESPACE=$RICPLT_NAMESPACE -fi -if [ -z "$RICXAPP_NAMESPACE" ];then - XAPP_NAMESPACE=$xapp_namespace -else - XAPP_NAMESPACE=$RICXAPP_NAMESPACE -fi -if [ -z "$RICAUX_NAMESPACE" ];then - AUX_NAMESPACE=$aux_namespace -else - AUX_NAMESPACE=$RICAUX_NAMESPACE -fi -if [ -z "$RICINFRA_NAMESPACE" ];then - INFRA_NAMESPACE=$infra_namespace -else - INFRA_NAMESPACE=$RICINFRA_NAMESPACE -fi -if [ -z "$RIC_COMMON_OVERRIDE" ];then - COMMON_OVERRIDE="--set global.namespace.platform=$PLT_NAMESPACE --set global.namespace.xapp=$XAPP_NAMESPACE --set global.namespace.aux=$AUX_NAMESPACE --set global.namespace.infra=$INFRA_NAMESPACE" -else - COMMON_OVERRIDE=$RIC_COMMON_OVERRIDE +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option." + echo "****************************************************************************************************************" + exit 1 fi -#helm install --name my-release stable/elastic-stack --set elasticsearch.data.persistence.enabled=false --set elasticsearch.master.persistence.enabled=false --set logstash.persistence.enabled=false +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +GLOBAL_BLOCK=$(cat $OVERRIDEYAML | awk '/^global:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *infra:/{print $2}') +RELEASE_PREFIX=$(echo "$GLOBAL_BLOCK" | awk '/^ *releasePrefix:/{print $2}') +COMPONENTS=${LIST_OF_COMPONENTS:-"elfkp"} + +echo "Deploying RIC infra components [$COMPONENTS]" -RICAUX_COMPONENTS="elfkp" -echo "Deploying RIC infra components [$RICAUX_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" -for component in $RICAUX_COMPONENTS; do +for component in $COMPONENTS; do + mkdir -p $DIR/../helm/$component/charts/ pushd $DIR/../helm/$component/ helm dep update popd - ELASTIC_SEARCH_HOST="${RELEASE_NAME}-${component}-elasticsearch-client.${NAMESPACE}.svc.cluster.local" - ELASTIC_SEARCH_PORT=9200 + #ELASTIC_SEARCH_HOST="${RELEASE_NAME}-${component}-elasticsearch-client.${NAMESPACE}.svc.cluster.local" + #ELASTIC_SEARCH_PORT=9200 #CMD="helm install --debug \ # --namespace ${NAMESPACE} --name ${RELEASE_NAME}-${component_clean} \ # -f ../helm/$component/values.yaml \ @@ -81,10 +72,5 @@ for component in $RICAUX_COMPONENTS; do # --set logstash.elasticsearch.host=${ELASTIC_SEARCH_PORT} \ # $component" #eval "$CMD" - - if [ -z $OVERRIDEYAML ]; then - helm install --debug --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - else - helm install -f $OVERRIDEYAML --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - fi + helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component done diff --git a/ric-infra/20-Monitoring/bin/uninstall b/ric-infra/20-Monitoring/bin/uninstall index 8a3ba149..f9ccccaa 100755 --- a/ric-infra/20-Monitoring/bin/uninstall +++ b/ric-infra/20-Monitoring/bin/uninstall @@ -15,27 +15,16 @@ # See the License for the specific language governing permissions and # # limitations under the License. # ################################################################################ +COMPONENTS="elfkp" +echo "Undeploying RIC infra components [$COMPONENTS]" -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +for component in $COMPONENTS; do + RELEASE_LIST=$(helm list | grep "$component" | awk '{print $1}') + if [ ! -z "$RELEASE_LIST" ];then + helm delete --purge $RELEASE_LIST + fi - -source $DIR/../etc/elfkp.conf - -if [ -z "$RICAUX_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICAUX_RELEASE_NAME -fi - -RICAUX_COMPONENTS="elfkp" - -echo "Undeploying RIC AUX components [$RICAUX_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" - - -for component in $RICAUX_COMPONENTS; do - helm delete --purge "${RELEASE_NAME}-${component}" done diff --git a/ric-infra/20-Monitoring/etc/elfkp.conf b/ric-infra/20-Monitoring/etc/elfkp.conf deleted file mode 100644 index 92008b59..00000000 --- a/ric-infra/20-Monitoring/etc/elfkp.conf +++ /dev/null @@ -1,37 +0,0 @@ -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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 # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# 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. # -################################################################################ - - -# helm_release_name defines the release name helm will use to deploy RIC -# It will be overrided by RICPLT_RELEASE_NAME -helm_release_name=r1 - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICPLT_NAMESPACE -plt_namespace=ricplt - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICXAPP_NAMESPACE -xapp_namespace=ricxapp - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICAUX_NAMESPACE -aux_namespace=ricaux - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICINFRA_NAMESPACE -infra_namespace=ricinfra diff --git a/ric-infra/30-Kong/bin/install b/ric-infra/30-Kong/bin/install index db2ccdaa..19eaf5df 100755 --- a/ric-infra/30-Kong/bin/install +++ b/ric-infra/30-Kong/bin/install @@ -17,69 +17,51 @@ ################################################################################ -OVERRIDEYAML=$1 +while [ -n "$1" ]; do # while loop starts + case "$1" in -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" - -source $DIR/../etc/kong.conf + -f) OVERRIDEYAML=$2 + shift + ;; + -c) LIST_OF_COMPONENTS=$2 + shift + ;; + *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c -if [ -z "$RICINFRA_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICINFRA_RELEASE_NAME -fi -# Namespace configuration -if [ -z "$RICPLT_NAMESPACE" ];then - PLT_NAMESPACE=$plt_namespace -else - PLT_NAMESPACE=$RICPLT_NAMESPACE -fi -if [ -z "$RICXAPP_NAMESPACE" ];then - XAPP_NAMESPACE=$xapp_namespace -else - XAPP_NAMESPACE=$RICXAPP_NAMESPACE -fi -if [ -z "$RICAUX_NAMESPACE" ];then - AUX_NAMESPACE=$aux_namespace -else - AUX_NAMESPACE=$RICAUX_NAMESPACE -fi -if [ -z "$RICINFRA_NAMESPACE" ];then - INFRA_NAMESPACE=$infra_namespace -else - INFRA_NAMESPACE=$RICINFRA_NAMESPACE -fi + esac -if [ -z "$RIC_COMMON_OVERRIDE" ];then - COMMON_OVERRIDE="--set global.namespace.platform=$PLT_NAMESPACE --set global.namespace.xapp=$XAPP_NAMESPACE --set global.namespace.aux=$AUX_NAMESPACE --set global.namespace.infra=$INFRA_NAMESPACE" -else - COMMON_OVERRIDE=$RIC_COMMON_OVERRIDE -fi + shift +done +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option." + echo "****************************************************************************************************************" + exit 1 +fi -RICINFRA_COMPONENTS="kong" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +GLOBAL_BLOCK=$(cat $OVERRIDEYAML | awk '/^global:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *infra:/{print $2}') +RELEASE_PREFIX=$(echo "$GLOBAL_BLOCK" | awk '/^ *releasePrefix:/{print $2}') +COMPONENTS=${LIST_OF_COMPONENTS:-"kong"} -echo "Deploying RIC infra components [$RICINFRA_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" +echo "Deploying RIC infra components [$COMPONENTS]" COMMON_CHART_VERSION=$(cat $DIR/../../../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}') helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common - -for component in $RICINFRA_COMPONENTS; do +for component in $COMPONENTS; do mkdir -p $DIR/../helm/$component/charts/ - cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/ - - if [ -z $OVERRIDEYAML ]; then - helm install --debug --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - else - helm install -f $OVERRIDEYAML --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - fi + helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component done diff --git a/ric-infra/30-Kong/bin/uninstall b/ric-infra/30-Kong/bin/uninstall index 01c97e06..b7ce8f36 100755 --- a/ric-infra/30-Kong/bin/uninstall +++ b/ric-infra/30-Kong/bin/uninstall @@ -19,31 +19,18 @@ -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +COMPONENTS="kong" -source $DIR/../etc/kong.conf +echo "Undeploying RIC infra components [$COMPONENTS]" -if [ -z "$RICINFRA_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICINFRA_RELEASE_NAME -fi -if [ -z "$RICINFRA_NAMESPACE" ];then - INFRA_NAMESPACE=$infra_namespace -else - INFRA_NAMESPACE=$RICINFRA_NAMESPACE -fi -RICINFRA_COMPONENTS="kong" +for component in $COMPONENTS; do + RELEASE_LIST=$(helm list | grep "$component" | awk '{print $1}') + if [ ! -z "$RELEASE_LIST" ];then + helm delete --purge $RELEASE_LIST + fi -echo "Undeploying RIC infra components [$RICINFRA_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" - - -for component in $RICINFRA_COMPONENTS; do - helm delete --purge "${RELEASE_NAME}-${component}" done - diff --git a/ric-infra/30-Kong/etc/kong.conf b/ric-infra/30-Kong/etc/kong.conf deleted file mode 100644 index 92008b59..00000000 --- a/ric-infra/30-Kong/etc/kong.conf +++ /dev/null @@ -1,37 +0,0 @@ -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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 # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# 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. # -################################################################################ - - -# helm_release_name defines the release name helm will use to deploy RIC -# It will be overrided by RICPLT_RELEASE_NAME -helm_release_name=r1 - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICPLT_NAMESPACE -plt_namespace=ricplt - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICXAPP_NAMESPACE -xapp_namespace=ricxapp - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICAUX_NAMESPACE -aux_namespace=ricaux - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICINFRA_NAMESPACE -infra_namespace=ricinfra diff --git a/ric-infra/40-Credential/bin/install b/ric-infra/40-Credential/bin/install index af9a258f..a8ed3939 100755 --- a/ric-infra/40-Credential/bin/install +++ b/ric-infra/40-Credential/bin/install @@ -16,65 +16,57 @@ # limitations under the License. # ################################################################################ +while [ -n "$1" ]; do # while loop starts -OVERRIDEYAML=$1 + case "$1" in + -f) OVERRIDEYAML=$2 + shift + ;; + -c) LIST_OF_COMPONENTS=$2 + shift + ;; + *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + esac + shift -source $DIR/../etc/credential.conf +done -if [ -z "$RICINFRA_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICINFRA_RELEASE_NAME -fi -# Namespace configuration -if [ -z "$RICPLT_NAMESPACE" ];then - PLT_NAMESPACE=$plt_namespace -else - PLT_NAMESPACE=$RICPLT_NAMESPACE -fi -if [ -z "$RICXAPP_NAMESPACE" ];then - XAPP_NAMESPACE=$xapp_namespace -else - XAPP_NAMESPACE=$RICXAPP_NAMESPACE -fi -if [ -z "$RICAUX_NAMESPACE" ];then - AUX_NAMESPACE=$aux_namespace -else - AUX_NAMESPACE=$RICAUX_NAMESPACE -fi -if [ -z "$RICINFRA_NAMESPACE" ];then - INFRA_NAMESPACE=$infra_namespace -else - INFRA_NAMESPACE=$RICINFRA_NAMESPACE -fi -if [ -z "$RIC_COMMON_OVERRIDE" ];then - COMMON_OVERRIDE="--set global.namespace.platform=$PLT_NAMESPACE --set global.namespace.xapp=$XAPP_NAMESPACE --set global.namespace.aux=$AUX_NAMESPACE --set global.namespace.infra=$INFRA_NAMESPACE" -else - COMMON_OVERRIDE=$RIC_COMMON_OVERRIDE +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option." + echo "****************************************************************************************************************" + exit 1 fi +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +GLOBAL_BLOCK=$(cat $OVERRIDEYAML | awk '/^global:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}') +INFRA_NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *infra:/{print $2}') +AUX_NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *aux:/{print $2}') +XAPP_NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *xapp:/{print $2}') +PLT_NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *platform:/{print $2}') +RELEASE_PREFIX=$(echo "$GLOBAL_BLOCK" | awk '/^ *releasePrefix:/{print $2}') +COMPONENTS=${LIST_OF_COMPONENTS:-"credential"} + +echo "Deploying RIC infra components [$COMPONENTS]" + COMMON_CHART_VERSION=$(cat $DIR/../../../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}') helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common -mkdir -p $DIR/../helm/credential/charts/ -cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/credential/charts/ +for component in $COMPONENTS; do - -if [ -z $OVERRIDEYAML ]; then - helm install --namespace "${PLT_NAMESPACE}" --name "${RELEASE_NAME}-${PLT_NAMESPACE}-credential" $COMMON_OVERRIDE $DIR/../helm/credential - helm install --namespace "${XAPP_NAMESPACE}" --name "${RELEASE_NAME}-${XAPP_NAMESPACE}-credential" $COMMON_OVERRIDE $DIR/../helm/credential - helm install --namespace "${AUX_NAMESPACE}" --name "${RELEASE_NAME}-${AUX_NAMESPACE}-credential" $COMMON_OVERRIDE $DIR/../helm/credential - helm install --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-${INFRA_NAMESPACE}-credential" $COMMON_OVERRIDE $DIR/../helm/credential -else - helm install -f $OVERRIDEYAML --namespace "${PLT_NAMESPACE}" --name "${RELEASE_NAME}-${PLT_NAMESPACE}-credential" $COMMON_OVERRIDE $DIR/../helm/credential - helm install -f $OVERRIDEYAML --namespace "${XAPP_NAMESPACE}" --name "${RELEASE_NAME}-${XAPP_NAMESPACE}-credential" $COMMON_OVERRIDE $DIR/../helm/credential - helm install -f $OVERRIDEYAML --namespace "${AUX_NAMESPACE}" --name "${RELEASE_NAME}-${AUX_NAMESPACE}-credential" $COMMON_OVERRIDE $DIR/../helm/credential - helm install -f $OVERRIDEYAML --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-${INFRA_NAMESPACE}-credential" $COMMON_OVERRIDE $DIR/../helm/credential -fi + mkdir -p $DIR/../helm/$component/charts/ + cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/ + helm install -f $OVERRIDEYAML --namespace "${PLT_NAMESPACE}" --name "${RELEASE_PREFIX}-${PLT_NAMESPACE}-credential" $DIR/../helm/$component + helm install -f $OVERRIDEYAML --namespace "${XAPP_NAMESPACE}" --name "${RELEASE_PREFIX}-${XAPP_NAMESPACE}-credential" $DIR/../helm/$component + helm install -f $OVERRIDEYAML --namespace "${AUX_NAMESPACE}" --name "${RELEASE_PREFIX}-${AUX_NAMESPACE}-credential" $DIR/../helm/$component + helm install -f $OVERRIDEYAML --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_PREFIX}-${INFRA_NAMESPACE}-credential" $DIR/../helm/$component +done diff --git a/ric-infra/40-Credential/bin/uninstall b/ric-infra/40-Credential/bin/uninstall index e112c061..c45136f3 100755 --- a/ric-infra/40-Credential/bin/uninstall +++ b/ric-infra/40-Credential/bin/uninstall @@ -17,45 +17,15 @@ ################################################################################ -OVERRIDEYAML=$1 +COMPONENTS="credential" +echo "Undeploying RIC infra components [$COMPONENTS]" -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" - - -source $DIR/../etc/credential.conf - -if [ -z "$RICINFRA_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICINFRA_RELEASE_NAME -fi - -# Namespace configuration -if [ -z "$RICPLT_NAMESPACE" ];then - PLT_NAMESPACE=$plt_namespace -else - PLT_NAMESPACE=$RICPLT_NAMESPACE -fi -if [ -z "$RICXAPP_NAMESPACE" ];then - XAPP_NAMESPACE=$xapp_namespace -else - XAPP_NAMESPACE=$RICXAPP_NAMESPACE -fi -if [ -z "$RICAUX_NAMESPACE" ];then - AUX_NAMESPACE=$aux_namespace -else - AUX_NAMESPACE=$RICAUX_NAMESPACE -fi -if [ -z "$RICINFRA_NAMESPACE" ];then - INFRA_NAMESPACE=$infra_namespace -else - INFRA_NAMESPACE=$RICINFRA_NAMESPACE -fi - -helm delete --purge "${RELEASE_NAME}-${PLT_NAMESPACE}-credential" -helm delete --purge "${RELEASE_NAME}-${XAPP_NAMESPACE}-credential" -helm delete --purge "${RELEASE_NAME}-${AUX_NAMESPACE}-credential" -helm delete --purge "${RELEASE_NAME}-${INFRA_NAMESPACE}-credential" +for component in $COMPONENTS; do + RELEASE_LIST=$(helm list | grep "$component" | awk '{print $1}') + if [ ! -z "$RELEASE_LIST" ];then + helm delete --purge $RELEASE_LIST + fi +done diff --git a/ric-infra/40-Credential/etc/credential.conf b/ric-infra/40-Credential/etc/credential.conf deleted file mode 100644 index 92008b59..00000000 --- a/ric-infra/40-Credential/etc/credential.conf +++ /dev/null @@ -1,37 +0,0 @@ -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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 # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# 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. # -################################################################################ - - -# helm_release_name defines the release name helm will use to deploy RIC -# It will be overrided by RICPLT_RELEASE_NAME -helm_release_name=r1 - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICPLT_NAMESPACE -plt_namespace=ricplt - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICXAPP_NAMESPACE -xapp_namespace=ricxapp - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICAUX_NAMESPACE -aux_namespace=ricaux - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICINFRA_NAMESPACE -infra_namespace=ricinfra diff --git a/ric-infra/45-Tiller/bin/install b/ric-infra/45-Tiller/bin/install index 74313b15..caecdd9a 100755 --- a/ric-infra/45-Tiller/bin/install +++ b/ric-infra/45-Tiller/bin/install @@ -15,75 +15,55 @@ # See the License for the specific language governing permissions and # # limitations under the License. # ################################################################################ -OVERRIDEYAML=$1 -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" -source $DIR/../etc/tiller.conf -if [ -z "$RICINFRA_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICINFRA_RELEASE_NAME -fi +while [ -n "$1" ]; do # while loop starts -# Namespace configuration -if [ -z "$RICPLT_NAMESPACE" ];then - PLT_NAMESPACE=$plt_namespace -else - PLT_NAMESPACE=$RICPLT_NAMESPACE -fi + case "$1" in -if [ -z "$RICXAPP_NAMESPACE" ];then - XAPP_NAMESPACE=$xapp_namespace -else - XAPP_NAMESPACE=$RICXAPP_NAMESPACE -fi + -f) OVERRIDEYAML=$2 + shift + ;; + -c) LIST_OF_COMPONENTS=$2 + shift + ;; + *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c -if [ -z "$RICAUX_NAMESPACE" ];then - AUX_NAMESPACE=$aux_namespace -else - AUX_NAMESPACE=$RICAUX_NAMESPACE -fi + esac -if [ -z "$RICINFRA_NAMESPACE" ];then - INFRA_NAMESPACE=$infra_namespace -else - INFRA_NAMESPACE=$RICINFRA_NAMESPACE -fi + shift -if [ -z "$RIC_COMMON_OVERRIDE" ];then - COMMON_OVERRIDE="--set global.namespace.platform=$PLT_NAMESPACE --set global.namespace.xapp=$XAPP_NAMESPACE --set global.namespace.aux=$AUX_NAMESPACE --set global.namespace.infra=$INFRA_NAMESPACE" -else - COMMON_OVERRIDE=$RIC_COMMON_OVERRIDE -fi +done -RICINFRA_COMPONENTS="xapp-tiller" +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option." + echo "****************************************************************************************************************" + exit 1 +fi + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +GLOBAL_BLOCK=$(cat $OVERRIDEYAML | awk '/^global:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *infra:/{print $2}') +RELEASE_PREFIX=$(echo "$GLOBAL_BLOCK" | awk '/^ *releasePrefix:/{print $2}') +COMPONENTS=${LIST_OF_COMPONENTS:-"xapp-tiller"} -echo "Deploying RIC infra components [$RICINFRA_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" +echo "Deploying RIC infra components [$COMPONENTS]" COMMON_CHART_VERSION=$(cat $DIR/../../../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}') helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common - -for component in $RICINFRA_COMPONENTS; do +for component in $COMPONENTS; do mkdir -p $DIR/../helm/$component/charts/ - cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/ - - if [ -z $OVERRIDEYAML ]; then - - EMPTY_CHART=$(helm template $DIR/../helm/$component | grep apiVersion:) - if [ ! -z "$EMPTY_CHART" ]; then - helm install --debug --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - fi - else - EMPTY_CHART=$(helm template -f $OVERRIDEYAML $DIR/../helm/$component | grep apiVersion:) - if [ ! -z "$EMPTY_CHART" ]; then - helm install -f $OVERRIDEYAML --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - fi + EMPTY_CHART=$(helm template -f $OVERRIDEYAML $DIR/../helm/$component | grep apiVersion:) + if [ ! -z "$EMPTY_CHART" ]; then + helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component fi done diff --git a/ric-infra/45-Tiller/bin/uninstall b/ric-infra/45-Tiller/bin/uninstall index 450e25ce..8045ef85 100755 --- a/ric-infra/45-Tiller/bin/uninstall +++ b/ric-infra/45-Tiller/bin/uninstall @@ -17,39 +17,21 @@ ################################################################################ +COMPONENTS="xapp-tiller" + +echo "Undeploying RIC infra components [$COMPONENTS]" +for component in $COMPONENTS; do + RELEASE_LIST=$(helm list | grep "$component" | awk '{print $1}') + if [ ! -z "$RELEASE_LIST" ];then + NAMESPACE=$(helm list | grep "$component" | awk 'END{print $11}') + helm delete --purge $RELEASE_LIST + + SECRET_LIST=$(kubectl get secret -n $NAMESPACE | awk '{ if ($2=="Opaque"){ print $1}}') + + for component in $SECRET_LIST; do + kubectl delete secret -n $NAMESPACE $component + done + fi - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" - - -source $DIR/../etc/tiller.conf - -if [ -z "$RICINFRA_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICINFRA_RELEASE_NAME -fi - -if [ -z "$RICINFRA_NAMESPACE" ];then - INFRA_NAMESPACE=$infra_namespace -else - INFRA_NAMESPACE=$RICINFRA_NAMESPACE -fi - -RICINFRA_COMPONENTS="xapp-tiller" - -echo "Undeploying RIC infra components [$RICINFRA_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" - - -for component in $RICINFRA_COMPONENTS; do - helm delete --purge "${RELEASE_NAME}-${component}" done - -# We need to manually delete the secret creates by the secret container -SECRET_LIST=$(kubectl get secret -n ricinfra | awk '{ if ($2=="Opaque"){ print $1}}') - -for component in $SECRET_LIST; do - kubectl delete secret -n $INFRA_NAMESPACE $component -done diff --git a/ric-infra/45-Tiller/etc/tiller.conf b/ric-infra/45-Tiller/etc/tiller.conf deleted file mode 100644 index 92008b59..00000000 --- a/ric-infra/45-Tiller/etc/tiller.conf +++ /dev/null @@ -1,37 +0,0 @@ -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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 # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# 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. # -################################################################################ - - -# helm_release_name defines the release name helm will use to deploy RIC -# It will be overrided by RICPLT_RELEASE_NAME -helm_release_name=r1 - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICPLT_NAMESPACE -plt_namespace=ricplt - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICXAPP_NAMESPACE -xapp_namespace=ricxapp - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICAUX_NAMESPACE -aux_namespace=ricaux - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICINFRA_NAMESPACE -infra_namespace=ricinfra diff --git a/ric-platform/50-RIC-Platform/bin/install b/ric-platform/50-RIC-Platform/bin/install index c14781a5..83c71822 100755 --- a/ric-platform/50-RIC-Platform/bin/install +++ b/ric-platform/50-RIC-Platform/bin/install @@ -15,72 +15,51 @@ # See the License for the specific language governing permissions and # # limitations under the License. # ################################################################################ +while [ -n "$1" ]; do # while loop starts + case "$1" in -OVERRIDEYAML=$1 + -f) OVERRIDEYAML=$2 + shift + ;; + -c) LIST_OF_COMPONENTS=$2 + shift + ;; + *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c + esac -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" - + shift -source $DIR/../etc/ric.conf +done -if [ -z "$RICPLT_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICPLT_RELEASE_NAME -fi -# Namespace configuration -if [ -z "$RICPLT_NAMESPACE" ];then - PLT_NAMESPACE=$plt_namespace -else - PLT_NAMESPACE=$RICPLT_NAMESPACE -fi -if [ -z "$RICXAPP_NAMESPACE" ];then - XAPP_NAMESPACE=$xapp_namespace -else - XAPP_NAMESPACE=$RICXAPP_NAMESPACE -fi -if [ -z "$RICAUX_NAMESPACE" ];then - AUX_NAMESPACE=$aux_namespace -else - AUX_NAMESPACE=$RICAUX_NAMESPACE -fi -if [ -z "$RICINFRA_NAMESPACE" ];then - INFRA_NAMESPACE=$infra_namespace -else - INFRA_NAMESPACE=$RICINFRA_NAMESPACE +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option." + echo "****************************************************************************************************************" + exit 1 fi -if [ -z "$RIC_COMMON_OVERRIDE" ];then - COMMON_OVERRIDE="--set global.namespace.platform=$PLT_NAMESPACE --set global.namespace.xapp=$XAPP_NAMESPACE --set global.namespace.aux=$AUX_NAMESPACE --set global.namespace.infra=$INFRA_NAMESPACE" -else - COMMON_OVERRIDE=$RIC_COMMON_OVERRIDE -fi - - -RICPLT_COMPONENTS="appmgr rtmgr dbaas e2mgr e2term a1mediator submgr vespamgr" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +GLOBAL_BLOCK=$(cat $OVERRIDEYAML | awk '/^global:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *platform:/{print $2}') +RELEASE_PREFIX=$(echo "$GLOBAL_BLOCK" | awk '/^ *releasePrefix:/{print $2}') +COMPONENTS=${LIST_OF_COMPONENTS:-"appmgr rtmgr dbaas e2mgr e2term a1mediator submgr vespamgr"} -echo "Deploying RIC Platform components [$RICPLT_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" +echo "Deploying RIC infra components [$COMPONENTS]" COMMON_CHART_VERSION=$(cat $DIR/../../../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}') - - helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common -for component in $RICPLT_COMPONENTS; do - echo "Preparing chart for comonent $component" +for component in $COMPONENTS; do - mkdir -p $DIR/../helm/$component/charts/ cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/ - if [ -z $OVERRIDEYAML ]; then - helm install --namespace "${PLT_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - else - helm install -f $OVERRIDEYAML --namespace "${PLT_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - fi + helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component done diff --git a/ric-platform/50-RIC-Platform/bin/uninstall b/ric-platform/50-RIC-Platform/bin/uninstall index 21a8e3fa..f991eac0 100755 --- a/ric-platform/50-RIC-Platform/bin/uninstall +++ b/ric-platform/50-RIC-Platform/bin/uninstall @@ -16,29 +16,16 @@ # limitations under the License. # ################################################################################ +COMPONENTS="appmgr rtmgr dbaas e2mgr e2term a1mediator submgr vespamgr" +echo "Undeploying RIC platform components [$COMPONENTS]" -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +for component in $COMPONENTS; do + RELEASE_LIST=$(helm list | grep "$component" | awk '{print $1}') + if [ ! -z "$RELEASE_LIST" ];then + helm delete --purge $RELEASE_LIST + fi -source $DIR/../etc/ric.conf - -if [ -z "$RICPLT_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICPLT_RELEASE_NAME -fi - -RICPLT_COMPONENTS="appmgr rtmgr dbaas e2mgr e2term a1mediator submgr vespamgr" - - -echo "Undeploying RIC Platform components [$RICPLT_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" - - - - -for component in $RICPLT_COMPONENTS; do - helm delete --purge "${RELEASE_NAME}-$component" done diff --git a/ric-platform/50-RIC-Platform/etc/ric.conf b/ric-platform/50-RIC-Platform/etc/ric.conf deleted file mode 100644 index 92008b59..00000000 --- a/ric-platform/50-RIC-Platform/etc/ric.conf +++ /dev/null @@ -1,37 +0,0 @@ -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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 # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# 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. # -################################################################################ - - -# helm_release_name defines the release name helm will use to deploy RIC -# It will be overrided by RICPLT_RELEASE_NAME -helm_release_name=r1 - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICPLT_NAMESPACE -plt_namespace=ricplt - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICXAPP_NAMESPACE -xapp_namespace=ricxapp - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICAUX_NAMESPACE -aux_namespace=ricaux - -# namespace defines the namespace that helm will use to deploy RIC -# It will be overrided by RICINFRA_NAMESPACE -infra_namespace=ricinfra diff --git a/ric-platform/55-Ext-Services/bin/install b/ric-platform/55-Ext-Services/bin/install index e6fd714f..aa97b28b 100755 --- a/ric-platform/55-Ext-Services/bin/install +++ b/ric-platform/55-Ext-Services/bin/install @@ -15,69 +15,51 @@ # See the License for the specific language governing permissions and # # limitations under the License. # ################################################################################ +while [ -n "$1" ]; do # while loop starts + case "$1" in -OVERRIDEYAML=$1 + -f) OVERRIDEYAML=$2 + shift + ;; + -c) LIST_OF_COMPONENTS=$2 + shift + ;; + *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c + esac -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" - -source $DIR/../etc/ext.conf + shift -if [ -z "$RICPLT_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICPLT_RELEASE_NAME -fi -# Namespace configuration -if [ -z "$RICPLT_NAMESPACE" ];then - PLT_NAMESPACE=$plt_namespace -else - PLT_NAMESPACE=$RICPLT_NAMESPACE -fi -if [ -z "$RICXAPP_NAMESPACE" ];then - XAPP_NAMESPACE=$xapp_namespace -else - XAPP_NAMESPACE=$RICXAPP_NAMESPACE -fi -if [ -z "$RICAUX_NAMESPACE" ];then - AUX_NAMESPACE=$aux_namespace -else - AUX_NAMESPACE=$RICAUX_NAMESPACE -fi -if [ -z "$RICINFRA_NAMESPACE" ];then - INFRA_NAMESPACE=$infra_namespace -else - INFRA_NAMESPACE=$RICINFRA_NAMESPACE -fi +done -if [ -z "$RIC_COMMON_OVERRIDE" ];then - COMMON_OVERRIDE="--set global.namespace.platform=$PLT_NAMESPACE --set global.namespace.xapp=$XAPP_NAMESPACE --set global.namespace.aux=$AUX_NAMESPACE --set global.namespace.infra=$INFRA_NAMESPACE" -else - COMMON_OVERRIDE=$RIC_COMMON_OVERRIDE +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option." + echo "****************************************************************************************************************" + exit 1 fi -RICPLT_COMPONENTS="extsvcplt" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +GLOBAL_BLOCK=$(cat $OVERRIDEYAML | awk '/^global:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}') +NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *platform:/{print $2}') +RELEASE_PREFIX=$(echo "$GLOBAL_BLOCK" | awk '/^ *releasePrefix:/{print $2}') +COMPONENTS=${LIST_OF_COMPONENTS:-"extsvcplt"} -echo "Deploying RIC Platform components [$RICPLT_COMPONENTS]" -echo "Helm Release Name: $RELEASE_NAME" +echo "Deploying RIC infra components [$COMPONENTS]" COMMON_CHART_VERSION=$(cat $DIR/../../../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}') - helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common -for component in $RICPLT_COMPONENTS; do - echo "Preparing chart for comonent $component" +for component in $COMPONENTS; do - - mkdir -p $DIR/../helm/$component/charts/ + mkdir -p $DIR/../helm/$component/charts/ cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/ - if [ -z $OVERRIDEYAML ]; then - helm install --debug --namespace "${PLT_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - else - helm install -f $OVERRIDEYAML --namespace "${PLT_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component - fi + helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component done diff --git a/ric-platform/55-Ext-Services/bin/uninstall b/ric-platform/55-Ext-Services/bin/uninstall index 751c157e..67db3a99 100755 --- a/ric-platform/55-Ext-Services/bin/uninstall +++ b/ric-platform/55-Ext-Services/bin/uninstall @@ -18,30 +18,17 @@ +COMPONENTS="extsvcplt" -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +echo "Undeploying RIC platform components [$COMPONENTS]" -source $DIR/../etc/ext.conf -if [ -z "$RICPLT_RELEASE_NAME" ];then - RELEASE_NAME=$helm_release_name -else - RELEASE_NAME=$RICPLT_RELEASE_NAME -fi -if [ -z "$RICPLT_NAMESPACE" ];then - NAMESPACE=$namespace -else - NAMESPACE=$RICPLT_NAMESPACE -fi +for component in $COMPONENTS; do + RELEASE_LIST=$(helm list | grep "$component" | awk '{print $1}') + if [ ! -z "$RELEASE_LIST" ];then + helm delete --purge $RELEASE_LIST + fi -RICPLT_COMPONENTS="extsvcplt" - -echo "Undeploying RIC Platform components [$RICPLT_COMPONENTS]" -echo "Platform Namespace: $NAMESPACE" -echo "Helm Release Name: $RELEASE_NAME" - - -for component in $RICPLT_COMPONENTS; do - helm delete --purge "${RELEASE_NAME}-$component" done +