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 ################################################################################
20 while [ -n "$1" ]; do # while loop starts
27 -c) LIST_OF_COMPONENTS=$2
30 *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c
39 if [ -z "$OVERRIDEYAML" ];then
40 echo "****************************************************************************************************************"
42 echo "****************************************************************************************************************"
43 echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option."
44 echo "****************************************************************************************************************"
49 HAS_RIC_COMMON_PACKAGE=$(helm search local/ric-common | grep ric-common)
51 if [ -z "$HAS_RIC_COMMON_PACKAGE" ];then
52 echo "****************************************************************************************************************"
54 echo "****************************************************************************************************************"
55 echo "Can't locate the ric-common helm package in the local repo. Please make sure that it is properly installed."
56 echo "****************************************************************************************************************"
60 HAS_AUX_COMMON_PACKAGE=$(helm search local/aux-common | grep aux-common)
62 if [ -z "$HAS_AUX_COMMON_PACKAGE" ];then
63 echo "****************************************************************************************************************"
65 echo "****************************************************************************************************************"
66 echo "Can't locate the aux-common helm package in the local repo. Please make sure that it is properly installed."
67 echo "****************************************************************************************************************"
73 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
75 COMMON_BLOCK=$(cat $OVERRIDEYAML | awk '/^common:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}')
76 NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}')
77 AUXNAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *aux:/{print $2}')
78 INFRANAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *infra:/{print $2}')
79 RELEASE_PREFIX=$(echo "$COMMON_BLOCK" | awk '/^ *releasePrefix:/{print $2}')
80 COMPONENTS=${LIST_OF_COMPONENTS:-"infrastructure dashboard ves message-router mrsub mc-stack portal aaf"}
83 NODENAME=$(kubectl get node | awk 'NR>1{print $1}')
85 for f in $NODENAME; do
86 LABEL=$(kubectl describe node $f | grep "local-storage=enable")
87 if [ ! -z "$LABEL" ]; then
92 FOUND_STORAGECLASS=$(grep storageclass $OVERRIDEYAML)
95 if ! $LABELFOUND && [ -z "$FOUND_STORAGECLASS" ]; then
96 echo "***********************************************************************************************"
97 echo "* ERROR!!!!!!!!!!!!! *"
98 echo "***********************************************************************************************"
99 echo "* Nodes label \"local-storage=enable\" is not found in any of the cluster node. *"
100 echo "* Please pick a node and label it using the following command. *"
101 echo "* kubectl label --overwrite nodes <YOUR_NODE_NAME> local-storage=enable *"
102 echo "***********************************************************************************************"
108 if [ -z "$FOUND_STORAGECLASS" ] && $LABELFOUND; then
110 DATAPATH=$(cat $DIR/../helm/dashboard/values.yaml | grep datapath | awk '{ print $2}' )
113 if [ ! -z $OVERRIDEYAML ]; then
114 DATAPATHOVERRIDE=$(cat $OVERRIDEYAML | grep datapath | awk '{ print $2}' )
117 if [ ! -z "$DATAPATHOVERRIDE" ]; then
118 DATAPATH=$DATAPATHOVERRIDE
121 if [ ! -d "$DATAPATH" ]; then
122 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 ; }
125 echo "***********************************************************************************************"
126 echo "* WARNING!!!!!!!!!!!!! *"
127 echo "***********************************************************************************************"
128 echo "* Dashboard will use local storage. Please make sure that directory *"
130 echo "* contains the proper files. *"
131 echo "***********************************************************************************************"
136 if ! kubectl get ns ${AUXNAMESPACE:-ricaux}> /dev/null 2>&1; then
137 kubectl create ns ${AUXNAMESPACE:-ricaux}
139 if ! kubectl get ns ${INFRANAMESPACE:-ricinfra}> /dev/null 2>&1; then
140 kubectl create ns ${INFRANAMESPACE:-ricinfra}
142 if ! kubectl get ns onap > /dev/null 2>&1; then
143 kubectl create ns onap
146 kubectl create configmap -n ${AUXNAMESPACE:-ricaux} aux-recipe --from-file=recipe=$OVERRIDEYAML
149 echo "Deploying AUX components [$COMPONENTS]"
153 for component in $COMPONENTS; do
154 helm dep up $DIR/../helm/$component
157 NODENAME=$(kubectl get node | awk 'NR>1{print $1}')
159 for f in $NODENAME; do
160 LABEL=$(kubectl describe node $f | grep "aaf-storage=enable")
161 if [ ! -z "$LABEL" ]; then
166 if ! $LABELFOUND; then
167 echo "***********************************************************************************************"
168 echo "* ERROR!!!!!!!!!!!!! *"
169 echo "***********************************************************************************************"
170 echo "* Nodes label \"aaf-storage=enable\" is not found in any of the cluster node. *"
171 echo "* Please pick a node and label it using the following command. *"
172 echo "* kubectl label --overwrite nodes <YOUR_NODE_NAME> aaf-storage=enable *"
173 echo "***********************************************************************************************"
175 helm install -f $OVERRIDEYAML --namespace "onap" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component
179 helm install -f $OVERRIDEYAML --namespace "${AUXNAMESPACE:-ricaux}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component