blob: 9a7b57747b17efdb7f1a3b6933f056366b689851 [file] [log] [blame]
Areli Fuss471a29702018-02-01 13:09:07 +02001#!/bin/sh
2set -x
3
4check_status()
5{
6 local rc=$1
7 shift
8 local comment="$@"
9 if [ ${rc} != 0 ]; then
10 echo "[ERR] Failure detected - ${comment}. Aborting !"
11 exit 255
12 fi
13}
14
15
16# Should be removed while private dockers (maven build) will be available:
17echo "[INFO] ONAP Docker login"
18sudo docker login -u docker -p docker nexus3.onap.org:10001
19check_status $? "Onap docker registry login"
20
21# Verify the kube-system pods are running:
22# kube-addon-manager, kube-dns, kubernetes-dashboard, storage-provisioner, tiller-deploy
23echo "[INFO] Wait for Kubernetes Service ..."
24cd ../../kubernetes
25status=0
26while [ ${status} -ne 5 ]
27do
28 status=$(sudo kubectl get pods --namespace kube-system -o json \
29 | jq -r '
30 .items[]
31 | select(.status.phase == "Running" and
32 ([ .status.conditions[] | select(.type == "Ready" and .status == "True") ]
33 | length ) == 1 )
34 | .metadata.namespace + "/" + .metadata.name
35 ' \
36 | wc -l )
37 sleep 3
38done
39
40# Create namespace
41echo "[INFO] Check Namespace existence"
42exist_namespace=$( sudo kubectl get namespaces | grep onap-sdc | grep Active | wc -l )
43if [ ${exist_namespace} -eq 0 ]; then
44 sudo kubectl create namespace onap-sdc
45 check_status $? "Create namespace"
46fi
47
48echo "[INFO] Running helm init"
49sudo helm init
50check_status $? "Helm init"
51
52set -x
53
54printf "[INFO] Wait for helm to get ready\n"
55helm_health=1
56while [ ${helm_health} -ne 0 ]
57do
58 sudo helm version | grep "Server" >/dev/null 2>&1
59 helm_health=$?
60 sleep 5
61done
62
63# Remove previous chart
64exist_chart=$( sudo helm ls onap-sdc -q | wc -l )
65if [ ${exist_chart} -ne 0 ];then
66 echo "[INFO] Delete the existing onap-sdc chart"
67 sudo helm del --purge onap-sdc
68 check_status $? "Delete chart"
69fi
70
71# Install updated chart
72echo "[INFO] Create onap-sdc deployment"
73sudo helm install sdc --name onap-sdc
74check_status $? "Install chart"