Merge R3 into master
[it/dep.git] / tools / k8s / bin / install
1 #!/bin/bash
2
3 ################################################################################
4 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
5 #   Copyright (c) 2019 Nokia.                                                  #
6 #                                                                              #
7 #   Licensed under the Apache License, Version 2.0 (the "License");            #
8 #   you may not use this file except in compliance with the License.           #
9 #   You may obtain a copy of the License at                                    #
10 #                                                                              #
11 #       http://www.apache.org/licenses/LICENSE-2.0                             #
12 #                                                                              #
13 #   Unless required by applicable law or agreed to in writing, software        #
14 #   distributed under the License is distributed on an "AS IS" BASIS,          #
15 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
16 #   See the License for the specific language governing permissions and        #
17 #   limitations under the License.                                             #
18 ################################################################################
19
20
21 # 1. Edit the ../etc/env.rc file for local deployment's Gerrit, Nexus repos, Helm repo
22 # parameters
23 # 2. Update the ../etc/openstack.rc file for OpenStack installation parameters
24 # 3. Running from an environment with OpenStackl CLI access
25
26 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
27 set -a
28 RCS="$(find $DIR/../etc -type f -maxdepth 1)"
29 for RC in $RCS; do
30   echo "reading in values in $RC"
31   source $RC
32 done
33 set +a
34
35 if [ -z "$WORKSPACE" ]; then
36     export WORKSPACE=`git rev-parse --show-toplevel`
37 fi
38 HEAT_DIR="$WORKSPACE/ric-infra/00-Kubernetes/heat"
39 BIN_DIR="$WORKSPACE/ric-infra/00-Kubernetes/bin"
40
41
42 stackname=aux
43
44 for stackname in ric aux; do
45     WORKDIR_NAME="WORKDIR_${stackname}"
46     WORKDIR="${BIN_DIR}/${WORKDIR_NAME}"
47     echo ./deploy-stack.sh -w "$WORKDIR_NAME" -s "$stackname" -n 2 -6 "../heat/env/${stackname}.env" ${SSH_KEY}
48 done
49
50 exit
51 # set up cross cluster hostname resolution for well-known host names
52 RIC_MST_IP=$(head -1 ${WORKDIR}/ips-ric | cut -f2 -d' ')
53 AUX_MST_IP=$(head -1 ${WORKDIR}/ips-aux | cut -f2 -d' ')
54 for IP in $(cut -f2 -d ' ' ips-ric); do
55    REMOTE_CMD="sudo sh -c \"echo '"$AUX_MST_IP" ves.aux.local' >> /etc/hosts; \
56                             echo '"$AUX_MST_IP" es.aux.local' >> /etc/hosts\""
57    ssh -i $SSH_KEY -q -o "StrictHostKeyChecking no" ubuntu@$IP "$REMOTE_CMD"
58 done
59 for IP in $(cut -f2 -d ' ' ips-aux); do
60    REMOTE_CMD="sudo sh -c \"echo '"$RIC_MST_IP" a1.aux.local' >> /etc/hosts\""
61    ssh -i $SSH_KEY -q -o "StrictHostKeyChecking no" ubuntu@$IP "$REMOTE_CMD"
62 done
63