Script to package it/dep repo as a debian package
[it/dep.git] / bin / deploy-ric-infra
1 #!/bin/bash
2 ################################################################################
3 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
4 #   Copyright (c) 2019 Nokia.                                                  #
5 #                                                                              #
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                                    #
9 #                                                                              #
10 #       http://www.apache.org/licenses/LICENSE-2.0                             #
11 #                                                                              #
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
19 # This script deploys RIC auxiliary function components automatically
20
21 OVERRIDEYAML=$1
22
23
24
25
26 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
27
28 source $DIR/../etc/ric-infra.conf
29
30 export RICINFRA_RELEASE_NAME=$ric_infra_helm_release_name
31
32 export RICINFRA_NAMESPACE=$ric_infra_namespace
33
34 export DEPLOY_K8S=$deployK8S
35
36 export DEPLOY_NEXUS=$deployNexus
37
38 export USE_LOCAL_HELM_REPO=$useLocalHelmRepo
39
40 export USE_LOCAL_DOCKER_REGISTRY=$useLocalDockerRegistry
41
42
43
44
45
46 source $DIR/../etc/ric-platform.conf
47
48 export RICPLT_RELEASE_NAME=$ric_platform_helm_release_name
49
50 export RICPLT_NAMESPACE=$ric_platform_namespace
51
52
53
54
55 if [ -z "$OVERRIDEYAML" ];then
56         echo "****************************************************************************************************************"
57         echo "                                                     WARNING                                                    "
58         echo "****************************************************************************************************************"
59         echo "Deploying RIC infrastructure components without deployment recipe. Default configurations are used."
60         echo "****************************************************************************************************************"
61
62 else
63
64         export DEPLOY_K8S=$(cat $OVERRIDEYAML | grep deployK8S | awk '{print $2}')
65         export DEPLOY_NEXUS=$(cat $OVERRIDEYAML | grep deployNexus | awk '{print $2}')
66         export USE_LOCAL_HELM_REPO=$(cat $OVERRIDEYAML | grep useLocalHelmRepo | awk '{print $2}')
67         export USE_LOCAL_DOCKER_REGISTRY=$(cat $OVERRIDEYAML | grep useLocalDockerRegistry | awk '{print $2}')
68 fi
69
70
71
72 if $USE_LOCAL_HELM_REPO  &&  [ "$DEPLOY_NEXUS" != "true" ];then
73         echo "****************************************************************************************************************"
74         echo "                                                     ERROR                                                    "
75         echo "****************************************************************************************************************"
76         echo "Local helm repo cannot be used if Nexus is not installed. Please change your configurations in the deployment recipe."
77         echo "****************************************************************************************************************"
78         exit 1
79 fi
80
81
82 if $USE_LOCAL_DOCKER_REGISTRY  &&  [ "$DEPLOY_NEXUS" != "true" ];then
83         echo "****************************************************************************************************************"
84         echo "                                                     ERROR                                                    "
85         echo "****************************************************************************************************************"
86         echo "Local docker registry cannot be used if Nexus is not installed. Please change your configurations in the deployment recipe."
87         echo "****************************************************************************************************************"
88         exit 1
89 fi
90
91
92 if $DEPLOY_K8S; then
93         echo "Deploying K8S. Please make sure that you configure files in ./ric-infra/00-Kubernetes/etc correctly."
94         . ../ric-infra/00-Kubernetes/bin/install
95 fi
96
97
98 if $DEPLOY_NEXUS; then
99         echo "Deploying Nexus."
100         . ../ric-infra/10-Nexus/bin/install $OVERRIDEYAML
101 fi
102
103
104