2 ################################################################################
3 # Copyright (c) 2019 AT&T Intellectual Property. #
4 # Copyright (c) 2019 Nokia. #
6 # Licensed under the Apache License, Version 2.0 (the "License"); #
7 # you may not use this file except in compliance with the License. #
8 # You may obtain a copy of the License at #
10 # http://www.apache.org/licenses/LICENSE-2.0 #
12 # Unless required by applicable law or agreed to in writing, software #
13 # distributed under the License is distributed on an "AS IS" BASIS, #
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
15 # See the License for the specific language governing permissions and #
16 # limitations under the License. #
17 ################################################################################
18 while [ -n "$1" ]; do # while loop starts
25 -c) LIST_OF_COMPONENTS=$2
28 *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c
36 if [ -z "$OVERRIDEYAML" ];then
37 echo "****************************************************************************************************************"
39 echo "****************************************************************************************************************"
40 echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option."
41 echo "****************************************************************************************************************"
45 HAS_COMMON_PACKAGE=$(helm search local/ric-common | grep ric-common)
47 if [ -z "$HAS_COMMON_PACKAGE" ];then
48 echo "****************************************************************************************************************"
50 echo "****************************************************************************************************************"
51 echo "Can't locate the ric-common helm package in the local repo. Please make sure that it is properly installed."
52 echo "****************************************************************************************************************"
66 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
67 COMMON_BLOCK=$(cat $OVERRIDEYAML | awk '/^common:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}')
68 NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}')
69 PLTNAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *platform:/{print $2}')
70 INFRANAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *infra:/{print $2}')
71 XAPPNAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *xapp:/{print $2}')
72 RELEASE_PREFIX=$(echo "$COMMON_BLOCK" | awk '/^ *releasePrefix:/{print $2}')
73 # replace the dbaasha with dbaas1 if deploying non HA DBaaS
74 COMPONENTS=${LIST_OF_COMPONENTS:-"infrastructure xapp-onboarder appmgr rtmgr dbaas1 e2mgr e2term a1mediator submgr vespamgr jaegeradapter o1mediator"}
75 echo "Deploying RIC infra components [$COMPONENTS]"
78 if ! kubectl get ns ${PLTNAMESPACE:-ricplt}> /dev/null 2>&1; then
79 kubectl create ns ${PLTNAMESPACE:-ricplt}
81 if ! kubectl get ns ${INFRANAMESPACE:-ricinfra}> /dev/null 2>&1; then
82 kubectl create ns ${INFRANAMESPACE:-ricinfra}
84 if ! kubectl get ns ${XAPPNAMESPACE:-ricxapp}> /dev/null 2>&1; then
85 kubectl create ns ${XAPPNAMESPACE:-ricxapp}
88 kubectl create configmap -n ${PLTNAMESPACE:-ricplt} ricplt-recipe --from-file=recipe=$OVERRIDEYAML
91 for component in $COMPONENTS; do
92 helm dep up $DIR/../helm/$component
93 helm install -f $OVERRIDEYAML --namespace "${PLTNAMESPACE:-ricplt}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component