blob: 1c2608ac7d6712c3db0d2f7dbe6810e16c5188a8 [file] [log] [blame]
Donald Hunterb4b9a052018-09-17 09:17:27 +01001#!/bin/sh
2# ================================================================================
3# Copyright (c) 2018 Cisco Systems. All rights reserved.
4# ================================================================================
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# ============LICENSE_END=========================================================
17
18# Install PNDA in Openstack with Heat templates
19# Expects:
20# Input files for components to be installed in /inputs
21
22if [ "z{{ .Values.enabled }}" != "ztrue" ]
23then
24 echo
25 echo "PNDA bootstrap is disabled - skipping pnda-cli launch"
26 echo
27 exit 0
28fi
29
30set -ex
31
Julien Barbot2e1bac92018-11-13 12:39:09 +010032CLUSTER_PREFIX="{{ .Release.Name }}-{{ include "common.namespace" . }}-pnda"
Donald Hunterb4b9a052018-09-17 09:17:27 +010033DATANODES="{{ .Values.pnda.dataNodes }}"
34KAFKANODES="{{ .Values.pnda.kafkaNodes }}"
35VERSION="{{ .Values.pnda.version }}"
36KEYPAIR_NAME="{{ .Values.pnda_keypair_name }}"
37KEYFILE="$KEYPAIR_NAME.pem"
38
39cd /pnda-cli
40
41cp /inputs/pnda_env.yaml .
42cp /secrets/pnda.pem $KEYFILE
43chmod 600 $KEYFILE
44
45(cd tools && ./gen-certs.py)
46
47KUBE_API="https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT_HTTPS/api/v1"
48KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
49
50for i in 1 2 3 4 5 6 7 8 9
51do
52 MIRROR_IP=$(curl -s $KUBE_API/namespaces/{{ include "common.namespace" . }}/services/dcae-pnda-mirror \
53 --header "Authorization: Bearer $KUBE_TOKEN" \
54 --insecure | jq -r '.status.loadBalancer.ingress[0].ip')
55
56 if [ "$MIRROR_IP" != "null" ]; then
57 break
58 fi
59 sleep 5
60done
61
62PNDA_MIRROR="http://$MIRROR_IP:80"
63
64sed -i -e 's?CLIENT_IP/32?CLIENT_IP?' bootstrap-scripts/package-install.sh
65
66./cli/pnda-cli.py create -e $CLUSTER_PREFIX -f pico -n $DATANODES -k $KAFKANODES \
67 -b $VERSION -s $KEYPAIR_NAME --set "mirrors.PNDA_MIRROR=$PNDA_MIRROR"