Add one-click deployment scripts for deploying INFRA PLT and AUX 13/513/3
authorZhe Huang <zhehuang@research.att.com>
Fri, 12 Jul 2019 21:06:51 +0000 (17:06 -0400)
committerZhe Huang <zhehuang@research.att.com>
Thu, 18 Jul 2019 04:45:02 +0000 (00:45 -0400)
Signed-off-by: Zhe Huang <zhehuang@research.att.com>
Change-Id: Iba53ba3e4b715b58e97a9c2b7814da52c0b757dc

13 files changed:
RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE
bin/deploy-ric-aux
bin/deploy-ric-infra
bin/deploy-ric-platform
bin/undeploy-ric-aux
bin/undeploy-ric-infra [moved from etc/ric-platform.conf with 69% similarity, mode: 0755]
bin/undeploy-ric-platform
etc/ric-infra.conf
etc/ric.conf [new file with mode: 0644]
ric-infra/00-Kubernetes/bin/uninstall [moved from etc/ric-aux.conf with 84% similarity, mode: 0755]
ric-infra/20-Monitoring/bin/install
ric-infra/40-Credential/bin/install
ric-infra/40-Credential/bin/uninstall

index 3912aea..ecedb0c 100644 (file)
@@ -62,6 +62,7 @@ global:
 cluster:
   deployK8S: false
   deployNexus: false
+  deployK8SMonitoringStake: false
   useLocalHelmRepo: false
   useLocalDockerRegistry: false
 
index 5ccb386..8a4546f 100755 (executable)
@@ -16,7 +16,7 @@
 #   limitations under the License.                                             #
 ################################################################################
 
-# This script deploys RIC auxiliary function components automatically
+# This script deploys RIC aux components automatically
 
 OVERRIDEYAML=$1
 
@@ -24,22 +24,27 @@ if [ -z "$OVERRIDEYAML" ];then
 echo "****************************************************************************************************************"
 echo "                                                     WARNING                                                    "
 echo "****************************************************************************************************************"
-echo "Deploying RIC auxiliary functions without deployment recipe. Default configurations are used."
+echo "Deploying RIC auxiliary without deployment recipe. Default configurations are used."
 echo "****************************************************************************************************************"
 
-
 fi
 
 
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 
-source $DIR/../etc/ric-aux.conf
+source $ROOT_DIR/../etc/ric.conf
 
-export RICAUX_RELEASE_NAME=$ric_aux_helm_release_name
 
-export RICAUX_NAMESPACE=$ric_aux_namespace
+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
 
+for component in $ROOT_DIR/../ric-aux/*/; do
+    # Will print */ if no directories are available
+    . $component/bin/install $OVERRIDEYAML
 
-. ../ric-aux/80-Auxiliary-Functions/bin/install $OVERRIDEYAML
+done
 
index 508bcbd..cc36c68 100755 (executable)
 #   limitations under the License.                                             #
 ################################################################################
 
-# This script deploys RIC auxiliary function components automatically
+# 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 "****************************************************************************************************************"
 
 
-
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
-
-source $DIR/../etc/ric-infra.conf
-
-export RICINFRA_RELEASE_NAME=$ric_infra_helm_release_name
-
-export RICINFRA_NAMESPACE=$ric_infra_namespace
-
-export DEPLOY_K8S=$deployK8S
-
-export DEPLOY_NEXUS=$deployNexus
-
-export USE_LOCAL_HELM_REPO=$useLocalHelmRepo
-
-export USE_LOCAL_DOCKER_REGISTRY=$useLocalDockerRegistry
-
-
+fi
 
 
+ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 
-source $DIR/../etc/ric-platform.conf
+source $ROOT_DIR/../etc/ric.conf
+source $ROOT_DIR/../etc/ric-infra.conf
 
-export RICPLT_RELEASE_NAME=$ric_platform_helm_release_name
 
-export RICPLT_NAMESPACE=$ric_platform_namespace
+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
 
 
+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
 
-if [ -z "$OVERRIDEYAML" ];then
-       echo "****************************************************************************************************************"
-       echo "                                                     WARNING                                                    "
-       echo "****************************************************************************************************************"
-       echo "Deploying RIC infrastructure components without deployment recipe. Default configurations are used."
-       echo "****************************************************************************************************************"
+if [ -z $DEPLOY_K8S_FROM_OVERRIDE ]; then
+       export DEPLOY_K8S=$deployK8S
+else
+       export DEPLOY_K8S=$DEPLOY_K8S_FROM_OVERRIDE
+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
 
-       export DEPLOY_K8S=$(cat $OVERRIDEYAML | grep deployK8S | awk '{print $2}')
-       export DEPLOY_NEXUS=$(cat $OVERRIDEYAML | grep deployNexus | awk '{print $2}')
-       export USE_LOCAL_HELM_REPO=$(cat $OVERRIDEYAML | grep useLocalHelmRepo | awk '{print $2}')
-       export USE_LOCAL_DOCKER_REGISTRY=$(cat $OVERRIDEYAML | grep useLocalDockerRegistry | awk '{print $2}')
+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
+fi
 
 
-if $USE_LOCAL_HELM_REPO  &&  [ "$DEPLOY_NEXUS" != "true" ];then
-       echo "****************************************************************************************************************"
-        echo "                                                     ERROR                                                    "
+if ! $USE_LOCAL_HELM_REPO; then
+        echo "****************************************************************************************************************"
+        echo "                                                     WARNING                                                    "
         echo "****************************************************************************************************************"
-        echo "Local helm repo cannot be used if Nexus is not installed. Please change your configurations in the deployment recipe."
+        echo "RIC will use an external helm repository. Please make sure that the certificate is included in the recipe file."
         echo "****************************************************************************************************************"
-       exit 1
 fi
 
 
-if $USE_LOCAL_DOCKER_REGISTRY  &&  [ "$DEPLOY_NEXUS" != "true" ];then
-       echo "****************************************************************************************************************"
-        echo "                                                     ERROR                                                    "
+if $USE_LOCAL_DOCKER_REGISTRYthen
+        echo "****************************************************************************************************************"
+        echo "                                                     WARNING                                                    "
         echo "****************************************************************************************************************"
-        echo "Local docker registry cannot be used if Nexus is not installed. Please change your configurations in the deployment recipe."
+        echo "RIC will use an internal docker registry. You need to manually include the certificate to all servers in the cluster."
         echo "****************************************************************************************************************"
-       exit 1
 fi
 
 
-if $DEPLOY_K8S; then
-       echo "Deploying K8S. Please make sure that you configure files in ./ric-infra/00-Kubernetes/etc correctly."
-       . ../ric-infra/00-Kubernetes/bin/install
-fi
-
 
-if $DEPLOY_NEXUS; then
-       echo "Deploying Nexus."
-       . ../ric-infra/10-Nexus/bin/install $OVERRIDEYAML
-fi
+for component in $ROOT_DIR/../ric-infra/*/; do
+       component_name=$(echo $component | awk '{n=split($0, temp,"/"); print temp[n-1];}')
+
+       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
+                       fi
+               ;;
+               15-Chartmuseum)
+                       if $USE_LOCAL_HELM_REPO; then
+                               . $component/bin/install $OVERRIDEYAM
+                       fi
+               ;;
+               20-Monitoring)
+                       if $DEPLOY_K8S_MONITORING; then
+                               . $component/bin/install $OVERRIDEYAM
+                       fi
+               ;;
+               *)
+                   . $component/bin/install $OVERRIDEYAM
+       
+       esac
+done
 
 
 
index 0997c26..b19a471 100755 (executable)
@@ -31,16 +31,23 @@ echo "**************************************************************************
 fi
 
 
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 
-source $DIR/../etc/ric-platform.conf
+source $ROOT_DIR/../etc/ric.conf
 
 
-export RICPLT_RELEASE_NAME=$ric_platform_helm_release_name
+export RICPLT_RELEASE_NAME=$helm_release_name
 
-export RICPLT_NAMESPACE=$ric_platform_namespace
+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-platform/*/; do
+    # Will print */ if no directories are available
+    . $component/bin/install $OVERRIDEYAML
+
+done
 
 
-. ../ric-platform/50-RIC-Platform/bin/install $OVERRIDEYAML
 
index df56d0e..735dfbf 100755 (executable)
 # This script deploys RIC auxiliary function components automatically
 
 
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 
-source $DIR/../etc/ric-aux.conf
+source $ROOT_DIR/../etc/ric.conf
 
-export RICAUX_RELEASE_NAME=$ric_aux_helm_release_name
+export RICAUX_RELEASE_NAME=$helm_release_name
 
-export RICAUX_NAMESPACE=$ric_aux_namespace
+export RICAUX_NAMESPACE=$aux_namespace
 
 
+for component in $ROOT_DIR/../ric-aux/*/; do
+    # Will print */ if no directories are available
+    . $component/bin/uninstall
+
+done
 
-. ../ric-aux/80-Auxiliary-Functions/bin/uninstall
 
old mode 100644 (file)
new mode 100755 (executable)
similarity index 69%
rename from etc/ric-platform.conf
rename to bin/undeploy-ric-infra
index 1054892..ea8ab35
@@ -1,3 +1,4 @@
+#!/bin/bash
 ################################################################################
 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
 #   Copyright (c) 2019 Nokia.                                                  #
 #   limitations under the License.                                             #
 ################################################################################
 
-# -------------------  RIC PLATFORM ---------------------------------------
+# This script deploys RIC auxiliary function components automatically
 
-# release name helm will use to deploy RIC platform componenets
-ric_platform_helm_release_name=r0
 
-# namespace that helm will use to deploy RIC
-ric_platform_namespace=ricplt
+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
+    . $component/bin/uninstall
+
+done
 
 
-# 
index e9e5c9f..adeea6a 100755 (executable)
 #   limitations under the License.                                             #
 ################################################################################
 
-# This script deploys RIC platform components automatically
+# This script deploys RIC auxiliary function components automatically
 
 
+ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+source $ROOT_DIR/../etc/ric.conf
 
-source $DIR/../etc/ric-platform.conf
+export RICPLT_RELEASE_NAME=$helm_release_name
 
+export RICPLT_NAMESPACE=$plt_namespace
 
-export RICPLT_RELEASE_NAME=$ric_platform_helm_release_name
 
-export RICPLT_NAMESPACE=$ric_platform_namespace
+for component in $ROOT_DIR/../ric-platform/*/; do
+    # Will print */ if no directories are available
+    . $component/bin/uninstall
 
+done
 
 
-. ../ric-platform/50-RIC-Platform/bin/uninstall
 
index a5ddb27..a442a8f 100644 (file)
 #   limitations under the License.                                             #
 ################################################################################
 
-# -------------------  RIC AUX ---------------------------------------
 
-# release name helm will use to deploy RIC infrastructure componenets
-ric_infra_helm_release_name=r0
-
-# namespace that helm will use to deploy RIC infrastructure componenets
-ric_infra_namespace=ricinfra
 
 # deploy the kubernete cluster
 deployK8S=false
 
-# deploy a nexus repository manager
-deployNexus=true
-
 # use the local helm repo
 useLocalHelmRepo=true
 
 # use the local docker registry
-useLocalDockerRegistry=false
+useLocalDockerRegistry=true
diff --git a/etc/ric.conf b/etc/ric.conf
new file mode 100644 (file)
index 0000000..038ae2d
--- /dev/null
@@ -0,0 +1,38 @@
+################################################################################
+#   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.                                             #
+################################################################################
+
+# -------------------  RIC AUX ---------------------------------------
+
+# 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
old mode 100644 (file)
new mode 100755 (executable)
similarity index 84%
rename from etc/ric-aux.conf
rename to ric-infra/00-Kubernetes/bin/uninstall
index 5123514..e79798d
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 ################################################################################
 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
 #   Copyright (c) 2019 Nokia.                                                  #
 #   limitations under the License.                                             #
 ################################################################################
 
-# -------------------  RIC AUX ---------------------------------------
-
-# release name helm will use to deploy RIC aux componenets
-ric_aux_helm_release_name=r0
-
-# namespace that helm will use to deploy RIC
-ric_aux_namespace=ricaux
 
+# This is a placeholder.
+echo "Please reset your kubernetes cluster manually."
index a714cee..58274bf 100755 (executable)
@@ -24,10 +24,10 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 
 source $DIR/../etc/elfkp.conf
 
-if [ -z "$RICAUX_RELEASE_NAME" ];then
+if [ -z "$RICINFRA_RELEASE_NAME" ];then
    RELEASE_NAME=$helm_release_name
 else
-   RELEASE_NAME=$RICAUX_RELEASE_NAME
+   RELEASE_NAME=$RICINFRA_RELEASE_NAME
 fi
 # Namespace configuration
 if [ -z "$RICPLT_NAMESPACE" ];then
@@ -61,7 +61,7 @@ fi
 
 RICAUX_COMPONENTS="elfkp"
 
-echo "Deploying RIC AUX components [$RICAUX_COMPONENTS]"
+echo "Deploying RIC infra components [$RICAUX_COMPONENTS]"
 echo "Helm Release Name: $RELEASE_NAME"
 
 
@@ -83,8 +83,8 @@ for component in $RICAUX_COMPONENTS; do
   #eval "$CMD"
 
   if [ -z $OVERRIDEYAML ]; then
-    helm install --debug --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component
+    helm install --debug --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component
   else
-    helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component
+    helm install -f $OVERRIDEYAML --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component
   fi
 done
index bae3107..9d547d0 100755 (executable)
@@ -25,10 +25,10 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 
 source $DIR/../etc/credential.conf
 
-if [ -z "$RICPLT_RELEASE_NAME" ];then
+if [ -z "$RICINFRA_RELEASE_NAME" ];then
    RELEASE_NAME=$helm_release_name
 else
-   RELEASE_NAME=$RICPLT_RELEASE_NAME
+   RELEASE_NAME=$RICINFRA_RELEASE_NAME
 fi
 # Namespace configuration
 if [ -z "$RICPLT_NAMESPACE" ];then
index 4eda797..e112c06 100755 (executable)
@@ -25,10 +25,10 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 
 source $DIR/../etc/credential.conf
 
-if [ -z "$RICPLT_RELEASE_NAME" ];then
+if [ -z "$RICINFRA_RELEASE_NAME" ];then
    RELEASE_NAME=$helm_release_name
 else
-   RELEASE_NAME=$RICPLT_RELEASE_NAME
+   RELEASE_NAME=$RICINFRA_RELEASE_NAME
 fi
 
 # Namespace configuration