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 "****************************************************************************************************************"
48 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
49 GLOBAL_BLOCK=$(cat $OVERRIDEYAML | awk '/^global:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}')
50 NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^ namespace:/{getline; while ($0 ~ /^ .*|^ *$/) {print $0; if (getline == 0) {break}}}')
51 NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *aux:/{print $2}')
52 RELEASE_PREFIX=$(echo "$GLOBAL_BLOCK" | awk '/^ *releasePrefix:/{print $2}')
53 COMPONENTS=${LIST_OF_COMPONENTS:-"dashboard ves message-router mrsub mc-stack portal aaf"}
56 NODENAME=$(kubectl get node | awk 'NR>1{print $1}')
58 for f in $NODENAME; do
59 LABEL=$(kubectl describe node $f | grep local-storage)
60 if [ ! -z "$LABEL" ]; then
65 FOUND_STORAGECLASS=$(grep storageclass $OVERRIDEYAML)
68 if ! $LABELFOUND && [ -z "$FOUND_STORAGECLASS" ]; then
69 echo "***********************************************************************************************"
70 echo "* ERROR!!!!!!!!!!!!! *"
71 echo "***********************************************************************************************"
72 echo "* Nodes label \"local-storage=enable\" is not found in any of the cluster node. *"
73 echo "* Please pick a node and label it using the following command. *"
74 echo "* kubectl label --overwrite nodes <YOUR_NODE_NAME> local-storage=enable *"
75 echo "***********************************************************************************************"
81 if [ -z "$FOUND_STORAGECLASS" ] && $LABELFOUND; then
83 DATAPATH=$(cat $DIR/../helm/dashboard/values.yaml | grep datapath | awk '{ print $2}' )
86 if [ ! -z $OVERRIDEYAML ]; then
87 DATAPATHOVERRIDE=$(cat $OVERRIDEYAML | grep datapath | awk '{ print $2}' )
90 if [ ! -z "$DATAPATHOVERRIDE" ]; then
91 DATAPATH=$DATAPATHOVERRIDE
94 if [ ! -d "$DATAPATH" ]; then
95 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 ; }
98 echo "***********************************************************************************************"
99 echo "* WARNING!!!!!!!!!!!!! *"
100 echo "***********************************************************************************************"
101 echo "* Dashboard will use local storage. Please make sure that directory *"
103 echo "* contains the proper files. *"
104 echo "***********************************************************************************************"
108 echo "Deploying RIC infra components [$COMPONENTS]"
110 COMMON_CHART_VERSION=$(cat $DIR/../../../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}')
111 helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common
114 for component in $COMPONENTS; do
116 dashboard | ves | message-router | mrsub | mc-stack | portal)
117 mkdir -p $DIR/../helm/$component/charts/
118 cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/
119 helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component
122 mkdir -p $DIR/../helm/$component/charts/
123 cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/
124 helm install -f $OVERRIDEYAML --namespace "onap" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component
127 helm install --namespace "${NAMESPACE}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component