aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-os-chef/scripts/k8s/deploy_k8s_sdc.sh
diff options
context:
space:
mode:
authorAreli Fuss <af732p@att.com>2018-02-01 13:09:07 +0200
committerMichael Lando <ml636r@att.com>2018-02-06 17:57:29 +0000
commit471a29706bfc3ed50a6c66f96ee6575fc2e3087b (patch)
treecce1286f59676a2f7097cb34146cfa94940d65b4 /sdc-os-chef/scripts/k8s/deploy_k8s_sdc.sh
parent00c6ec7d386bd27c7752cf86e4692669e8b850ab (diff)
Add K8S deployment above Vagrant
Set deployment manifest files and scripts for deploy SDC over Kubernetes inside Vagrant Preparation for OOM integration Change-Id: I1f54b95067538f42d2d68fa3366b512dc9134f43 Issue-ID: SDC-907 Signed-off-by: Areli Fuss <af732p@att.com>
Diffstat (limited to 'sdc-os-chef/scripts/k8s/deploy_k8s_sdc.sh')
-rw-r--r--sdc-os-chef/scripts/k8s/deploy_k8s_sdc.sh74
1 files changed, 74 insertions, 0 deletions
diff --git a/sdc-os-chef/scripts/k8s/deploy_k8s_sdc.sh b/sdc-os-chef/scripts/k8s/deploy_k8s_sdc.sh
new file mode 100644
index 0000000000..9a7b57747b
--- /dev/null
+++ b/sdc-os-chef/scripts/k8s/deploy_k8s_sdc.sh
@@ -0,0 +1,74 @@
+#!/bin/sh
+set -x
+
+check_status()
+{
+ local rc=$1
+ shift
+ local comment="$@"
+ if [ ${rc} != 0 ]; then
+ echo "[ERR] Failure detected - ${comment}. Aborting !"
+ exit 255
+ fi
+}
+
+
+# Should be removed while private dockers (maven build) will be available:
+echo "[INFO] ONAP Docker login"
+sudo docker login -u docker -p docker nexus3.onap.org:10001
+check_status $? "Onap docker registry login"
+
+# Verify the kube-system pods are running:
+# kube-addon-manager, kube-dns, kubernetes-dashboard, storage-provisioner, tiller-deploy
+echo "[INFO] Wait for Kubernetes Service ..."
+cd ../../kubernetes
+status=0
+while [ ${status} -ne 5 ]
+do
+ status=$(sudo kubectl get pods --namespace kube-system -o json \
+ | jq -r '
+ .items[]
+ | select(.status.phase == "Running" and
+ ([ .status.conditions[] | select(.type == "Ready" and .status == "True") ]
+ | length ) == 1 )
+ | .metadata.namespace + "/" + .metadata.name
+ ' \
+ | wc -l )
+ sleep 3
+done
+
+# Create namespace
+echo "[INFO] Check Namespace existence"
+exist_namespace=$( sudo kubectl get namespaces | grep onap-sdc | grep Active | wc -l )
+if [ ${exist_namespace} -eq 0 ]; then
+ sudo kubectl create namespace onap-sdc
+ check_status $? "Create namespace"
+fi
+
+echo "[INFO] Running helm init"
+sudo helm init
+check_status $? "Helm init"
+
+set -x
+
+printf "[INFO] Wait for helm to get ready\n"
+helm_health=1
+while [ ${helm_health} -ne 0 ]
+do
+ sudo helm version | grep "Server" >/dev/null 2>&1
+ helm_health=$?
+ sleep 5
+done
+
+# Remove previous chart
+exist_chart=$( sudo helm ls onap-sdc -q | wc -l )
+if [ ${exist_chart} -ne 0 ];then
+ echo "[INFO] Delete the existing onap-sdc chart"
+ sudo helm del --purge onap-sdc
+ check_status $? "Delete chart"
+fi
+
+# Install updated chart
+echo "[INFO] Create onap-sdc deployment"
+sudo helm install sdc --name onap-sdc
+check_status $? "Install chart"