FIX: Nanobot cleanup, bugfixes, and features
[it/test.git] / ric_robot_suite / helm / robot_install.sh
1 opyright (c) 2019 AT&T Intellectual Property.                             #
2 #   Copyright (c) 2019 Nokia.                                                  #
3 #                                                                              #
4 #   Licensed under the Apache License, Version 2.0 (the "License");            #
5 #   you may not use this file except in compliance with the License.           #
6 #   You may obtain a copy of the License at                                    #
7 #                                                                              #
8 #       http://www.apache.org/licenses/LICENSE-2.0                             #
9 #                                                                              #
10 #   Unless required by applicable law or agreed to in writing, software        #
11 #   distributed under the License is distributed on an "AS IS" BASIS,          #
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
13 #   See the License for the specific language governing permissions and        #
14 #   limitations under the License.                                             #
15 ################################################################################
16
17
18 OVERRIDEYAML=$1
19
20
21 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
22
23 #/root/test/ric_robot_suite/helm
24 # extract the base to find root to dep
25
26 BASE=${DIR%/test*}
27
28 # /data/ORAN-OSC/it/dep/ric-platform/50-RIC-Platform/bin/install
29 BASEDIR50=$BASE/dep/ric-platform/50-RIC-Platform/
30 BASEDIRCOMMON=$BASE/dep/ric-common/Common-Template/helm/ric-common
31
32 echo "Using etc/ric.conf from $BASEDIR50"
33
34 source $BASEDIR50/etc/ric.conf
35
36
37 if [ -z "$RICPLT_RELEASE_NAME" ];then
38    RELEASE_NAME=$helm_release_name
39 else
40    RELEASE_NAME=$RICPLT_RELEASE_NAME
41 fi
42
43 # Namespace configuration
44 if [ -z "$RICPLT_NAMESPACE" ];then
45    PLT_NAMESPACE=$plt_namespace
46 else
47    PLT_NAMESPACE=$RICPLT_NAMESPACE
48 fi
49
50 RICPLT_COMPONENTS="ric-robot"
51
52 echo "Deploying RIC Platform components [$RICPLT_COMPONENTS]"
53 echo "Platform Namespace: $PLT_NAMESPACE"
54 echo "Helm Release Name: $RELEASE_NAME"
55
56
57 #COMMON_CHART_VERSION=$(cat $BASEDIR50/helm/common/Chart.yaml | grep version | awk '{print $2}')
58 COMMON_CHART_VERSION=$(cat $BASEDIRCOMMON/Chart.yaml | grep version | awk '{print $2}')
59
60
61
62 helm package -d /tmp $BASEDIRCOMMON
63
64
65 for component in $RICPLT_COMPONENTS; do
66   echo "Preparing chart for comonent $component"
67   mkdir -p $DIR/$component/charts/
68   cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/$component/charts/
69   if [ -z $OVERRIDEYAML ]; then
70   echo "helm install --namespace \"${PLT_NAMESPACE}\" --set \"Release.HelmReleaseName=${RELEASE_NAME}\" --name \"${RELEASE_NAME}-$component\" $DIR/../helm/$component"
71   helm install --namespace "${PLT_NAMESPACE}" --set "Release.HelmReleaseName=${RELEASE_NAME}"  --name "${RELEASE_NAME}-$component" $DIR/$component
72   else
73   echo "helm install -f $OVERRIDEYAML --namespace \"${PLT_NAMESPACE}\" --set \"Release.HelmReleaseName=${RELEASE_NAME}\"  --name \"${RELEASE_NAME}-$component\" $DIR/../helm/$component"
74   helm install -f $OVERRIDEYAML --namespace "${PLT_NAMESPACE}" --set "Release.HelmReleaseName=${RELEASE_NAME}"  --name "${RELEASE_NAME}-$component" $DIR/$component
75   fi
76 done
77