Donald Hunter | b4b9a05 | 2018-09-17 09:17:27 +0100 | [diff] [blame] | 1 | #!/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 | |
| 22 | if [ "z{{ .Values.enabled }}" != "ztrue" ] |
| 23 | then |
| 24 | echo |
| 25 | echo "PNDA bootstrap is disabled - skipping pnda-cli launch" |
| 26 | echo |
| 27 | exit 0 |
| 28 | fi |
| 29 | |
| 30 | set -ex |
| 31 | |
Julien Barbot | 2e1bac9 | 2018-11-13 12:39:09 +0100 | [diff] [blame] | 32 | CLUSTER_PREFIX="{{ .Release.Name }}-{{ include "common.namespace" . }}-pnda" |
Donald Hunter | b4b9a05 | 2018-09-17 09:17:27 +0100 | [diff] [blame] | 33 | DATANODES="{{ .Values.pnda.dataNodes }}" |
| 34 | KAFKANODES="{{ .Values.pnda.kafkaNodes }}" |
| 35 | VERSION="{{ .Values.pnda.version }}" |
| 36 | KEYPAIR_NAME="{{ .Values.pnda_keypair_name }}" |
| 37 | KEYFILE="$KEYPAIR_NAME.pem" |
| 38 | |
| 39 | cd /pnda-cli |
| 40 | |
| 41 | cp /inputs/pnda_env.yaml . |
| 42 | cp /secrets/pnda.pem $KEYFILE |
| 43 | chmod 600 $KEYFILE |
| 44 | |
| 45 | (cd tools && ./gen-certs.py) |
| 46 | |
| 47 | KUBE_API="https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT_HTTPS/api/v1" |
| 48 | KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) |
| 49 | |
| 50 | for i in 1 2 3 4 5 6 7 8 9 |
| 51 | do |
| 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 |
| 60 | done |
| 61 | |
| 62 | PNDA_MIRROR="http://$MIRROR_IP:80" |
| 63 | |
| 64 | sed -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" |