3 # ================================================================================
4 # Copyright (c) 2018 Cisco Systems. All rights reserved.
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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 # ============LICENSE_END=========================================================
20 # Install PNDA in Openstack with Heat templates
22 # Input files for components to be installed in /inputs
24 if [ "z{{ .Values.enabled }}" != "ztrue" ]
27 echo "PNDA bootstrap is disabled - skipping pnda-cli launch"
34 CLUSTER_PREFIX="{{ include "common.release" . }}-{{ include "common.namespace" . }}-pnda"
35 DATANODES="{{ .Values.pnda.dataNodes }}"
36 KAFKANODES="{{ .Values.pnda.kafkaNodes }}"
37 VERSION="{{ .Values.pnda.version }}"
38 KEYPAIR_NAME="{{ .Values.pnda_keypair_name }}"
39 KEYFILE="$KEYPAIR_NAME.pem"
43 cp /inputs/pnda_env.yaml .
44 cp /secrets/pnda.pem $KEYFILE
47 (cd tools && ./gen-certs.py)
49 KUBE_API="https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT_HTTPS/api/v1"
50 KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
52 for i in 1 2 3 4 5 6 7 8 9
54 MIRROR_IP=$(curl -s $KUBE_API/namespaces/{{ include "common.namespace" . }}/pods \
55 --header "Authorization: Bearer $KUBE_TOKEN" \
56 --insecure | jq -r '.items[].status | select(.containerStatuses != null) | select(.containerStatuses[].ready and .containerStatuses[].name=="dcae-pnda-mirror") | .hostIP')
57 MIRROR_PORT=$(curl -s $KUBE_API/namespaces/{{ include "common.namespace" . }}/services/dcae-pnda-mirror \
58 --header "Authorization: Bearer $KUBE_TOKEN" \
59 --insecure | jq -r '.spec.ports[] | select(.name=="dcae-pnda-mirror") | .nodePort')
61 if [ "x${MIRROR_IP}" != "xnull" -a "x${MIRROR_PORT}" != "xnull" ]; then
62 PNDA_MIRROR="http://$MIRROR_IP:$MIRROR_PORT"
68 [ -z "${PNDA_MIRROR}" ] && { echo "Unable to get PNDA mirror IP:PORT"; exit 1; }
70 sed -i -e 's?CLIENT_IP/32?CLIENT_IP?' bootstrap-scripts/package-install.sh
72 ./cli/pnda-cli.py create -e $CLUSTER_PREFIX -f pico -n $DATANODES -k $KAFKANODES \
73 -b $VERSION -s $KEYPAIR_NAME --set "mirrors.PNDA_MIRROR=$PNDA_MIRROR"