summaryrefslogtreecommitdiffstats
path: root/vagrant/tests
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2018-11-14 09:15:36 -0800
committerVictor Morales <victor.morales@intel.com>2018-11-14 09:21:13 -0800
commitdaf3a00798ee77e469cd89cb16ade818c50968f9 (patch)
tree3ef383d90fd3a1fb588fedc65a4d6b5fe019cbf2 /vagrant/tests
parentcc05d4af8f082d8174bde5c43fc45b1acc61339f (diff)
Enable Istio
This commit includes the playbook that installs and configure Istio Service Mesh services. It also defines a draft script for testing its sample. Change-Id: I7f0049aae4ae0033356c370a0e86d583e7bf744f Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: MULTICLOUD-406
Diffstat (limited to 'vagrant/tests')
-rwxr-xr-xvagrant/tests/_functions.sh1
-rwxr-xr-xvagrant/tests/istio.sh40
2 files changed, 41 insertions, 0 deletions
diff --git a/vagrant/tests/_functions.sh b/vagrant/tests/_functions.sh
index 515bc6ec..c359e729 100755
--- a/vagrant/tests/_functions.sh
+++ b/vagrant/tests/_functions.sh
@@ -84,3 +84,4 @@ if ! $(kubectl version &>/dev/null); then
echo "This funtional test requires kubectl client"
exit 1
fi
+test_folder=$(pwd)
diff --git a/vagrant/tests/istio.sh b/vagrant/tests/istio.sh
new file mode 100755
index 00000000..79ef4ac8
--- /dev/null
+++ b/vagrant/tests/istio.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+source _functions.sh
+
+csar_id=ac39959e-e82c-11e8-9133-525400912638
+
+base_dest=$(grep "base_dest:" $test_folder/../playbooks/krd-vars.yml | awk -F ': ' '{print $2}')
+istio_dest=$(grep "istio_dest:" $test_folder/../playbooks/krd-vars.yml | awk -F ': ' '{print $2}' | sed "s|{{ base_dest }}|$base_dest|g;s|\"||g")
+istio_version=$(grep "istio_version:" $test_folder/../playbooks/krd-vars.yml | awk -F ': ' '{print $2}')
+
+if ! $(istioctl version &>/dev/null); then
+ echo "This funtional test requires istioctl client"
+ exit 1
+fi
+
+_checks_args $csar_id
+pushd ${CSAR_DIR}/${csar_id}
+istioctl kube-inject -f $istio_dest/istio-$istio_version/samples/bookinfo/platform/kube/bookinfo.yaml > bookinfo-inject.yml
+kubectl apply -f bookinfo-inject.yml
+kubectl apply -f $istio_dest/istio-$istio_version/samples/bookinfo/networking/bookinfo-gateway.yaml
+
+for deployment in details-v1 productpage-v1 ratings-v1 reviews-v1 reviews-v2 reviews-v3; do
+ wait_deployment $deployment
+done
+INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
+INGRESS_HOST=$(kubectl get po -l istio=ingressgateway -n istio-system -o 'jsonpath={.items[0].status.hostIP}')
+curl -o /dev/null -s -w "%{http_code}\n" http://$INGRESS_HOST:$INGRESS_PORT/productpage
+popd