| #!/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 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 |
| |
| |
| 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 $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 |
| |
| 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; 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 |
| |
| |
| 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 |
| |
| |
| |
| 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 |
| |
| |
| |