aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--vagrant/README.md2
-rw-r--r--vagrant/galaxy-requirements.yml2
-rw-r--r--vagrant/inventory/group_vars/k8s-cluster.yml3
-rw-r--r--vagrant/playbooks/configure-istio.yml49
-rw-r--r--vagrant/playbooks/krd-vars.yml5
-rwxr-xr-xvagrant/tests/_functions.sh1
-rwxr-xr-xvagrant/tests/istio.sh40
7 files changed, 100 insertions, 2 deletions
diff --git a/vagrant/README.md b/vagrant/README.md
index c76b081e..c433a607 100644
--- a/vagrant/README.md
+++ b/vagrant/README.md
@@ -18,6 +18,7 @@ Virtual Machines.
| Virtlet | Allows to run VMs | [configure-virtlet.yml][4] | Tested |
| Multus | Provides Multiple Network support in a pod | [configure-multus.yml][5] | Tested |
| NFD | Node feature discovery | [configure-nfd.yml][7] | Tested |
+| Istio | Service Mesh platform | [configure-istio.yml][8] | Tested |
## Deployment
@@ -50,3 +51,4 @@ Apache-2.0
[5]: playbooks/configure-multus.yml
[6]: https://www.vagrantup.com/
[7]: playbooks/configure-nfd.yml
+[8]: playbooks/configure-istio.yml
diff --git a/vagrant/galaxy-requirements.yml b/vagrant/galaxy-requirements.yml
index e3a0fd98..4b252964 100644
--- a/vagrant/galaxy-requirements.yml
+++ b/vagrant/galaxy-requirements.yml
@@ -11,5 +11,7 @@
version: v2.1.10
- src: andrewrothstein.kubectl
version: v1.1.12
+- src: andrewrothstein.kubernetes-helm
+ version: v1.2.9
- src: geerlingguy.docker
version: 2.5.1
diff --git a/vagrant/inventory/group_vars/k8s-cluster.yml b/vagrant/inventory/group_vars/k8s-cluster.yml
index c6008de8..f038d4f2 100644
--- a/vagrant/inventory/group_vars/k8s-cluster.yml
+++ b/vagrant/inventory/group_vars/k8s-cluster.yml
@@ -60,8 +60,7 @@ local_volumes_enabled: true
kube_version: v1.11.3
# Helm deployment
-# NOTE(electrocuracha): This value might be changed for the istio implementation
-helm_enabled: false
+helm_enabled: true
# Kube-proxy proxyMode configuration.
# NOTE: Ipvs is based on netfilter hook function, but uses hash table as the underlying data structure and
diff --git a/vagrant/playbooks/configure-istio.yml b/vagrant/playbooks/configure-istio.yml
new file mode 100644
index 00000000..25a343f0
--- /dev/null
+++ b/vagrant/playbooks/configure-istio.yml
@@ -0,0 +1,49 @@
+---
+# 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
+##############################################################################
+
+- hosts: localhost
+ become: yes
+ pre_tasks:
+ - name: Load krd variables
+ include_vars:
+ file: krd-vars.yml
+ roles:
+ - andrewrothstein.kubectl
+ - role: andrewrothstein.kubernetes-helm
+ kubernetes_helm_ver: v2.9.1
+ tasks:
+ - name: create istio folder
+ file:
+ state: directory
+ path: "{{ istio_dest }}"
+ - name: getting istio CRDs
+ block:
+ - name: download istio tarball
+ get_url:
+ url: "{{ istio_url }}"
+ dest: "/tmp/istio.tar.gz"
+ - name: extract istio source code
+ unarchive:
+ src: "/tmp/istio.tar.gz"
+ dest: "{{ istio_dest }}"
+ remote_src: yes
+ - name: copy istioctl binary to usr/local/bin folder
+ command: "mv {{ istio_dest }}/istio-{{ istio_version }}/bin/istioctl /usr/local/bin/"
+ when: istio_source_type == "tarball"
+ - name: create network objects
+ shell: "/usr/local/bin/kubectl apply -f {{ istio_dest }}/istio-{{ istio_version }}/install/kubernetes/helm/istio/templates/crds.yaml"
+ - name: render istio's core components
+ shell: "/usr/local/bin/helm template {{ istio_dest }}/istio-{{ istio_version }}/install/kubernetes/helm/istio --name istio --namespace istio-system > /tmp/istio.yaml"
+ - name: create istio manifest
+ shell: "/usr/local/bin/kubectl create namespace istio-system"
+ ignore_errors: True
+ - name: install the components via the manifest
+ shell: "/usr/local/bin/kubectl apply -f /tmp/istio.yaml"
+ ignore_errors: True
diff --git a/vagrant/playbooks/krd-vars.yml b/vagrant/playbooks/krd-vars.yml
index b8755a50..9c2de308 100644
--- a/vagrant/playbooks/krd-vars.yml
+++ b/vagrant/playbooks/krd-vars.yml
@@ -46,5 +46,10 @@ nfd_source_type: "source"
nfd_version: 175305b1ad73be7301ac94add475cec6fef797a9
nfd_url: "https://github.com/kubernetes-incubator/node-feature-discovery"
+istio_dest: "{{ base_dest }}/istio"
+istio_source_type: "tarball"
+istio_version: 1.0.3
+istio_url: "https://github.com/istio/istio/releases/download/{{ istio_version }}/istio-{{ istio_version }}-linux.tar.gz"
+
go_version: 1.11.1
kubespray_version: 2.7.0
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