From 432051cffd380d4d842223737e3949a3826683c8 Mon Sep 17 00:00:00 2001 From: trevortao Date: Thu, 25 Jan 2018 14:31:50 +0800 Subject: Add Kubernetes deployment scenario with 2 Flannel interfaces 1. README file 2. Deployement scripts Change-Id: I1f99ba77e803c8bbc5c40ae783b32ff0c7218375 Signed-off-by: trevortao --- src/arm/kubernetes_2flannel/README.rst | 15 +++++++++++ src/arm/kubernetes_2flannel/k8s-build.sh | 32 ++++++++++++++++++++++ src/arm/kubernetes_2flannel/k8s-deploy.sh | 44 +++++++++++++++++++++++++++++++ src/arm/kubernetes_2flannel/setup.sh | 7 +++++ 4 files changed, 98 insertions(+) create mode 100644 src/arm/kubernetes_2flannel/README.rst create mode 100755 src/arm/kubernetes_2flannel/k8s-build.sh create mode 100755 src/arm/kubernetes_2flannel/k8s-deploy.sh create mode 100755 src/arm/kubernetes_2flannel/setup.sh (limited to 'src/arm') diff --git a/src/arm/kubernetes_2flannel/README.rst b/src/arm/kubernetes_2flannel/README.rst new file mode 100644 index 0000000..354bff1 --- /dev/null +++ b/src/arm/kubernetes_2flannel/README.rst @@ -0,0 +1,15 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International +.. License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) OPNFV, arm Limited. + +.. _Flannel: https://github.com/coreos/flannel + +=============================================== +Kubernetes Deployment with 2 Flannel Interfaces +=============================================== + +The scenario would deploy 2 Flannel_ interfaces for any created pods, in which one interface +named "eth0" would be used as the default interface, and the 2nd interface named "net0" would +route to another subnet. + diff --git a/src/arm/kubernetes_2flannel/k8s-build.sh b/src/arm/kubernetes_2flannel/k8s-build.sh new file mode 100755 index 0000000..23d1d31 --- /dev/null +++ b/src/arm/kubernetes_2flannel/k8s-build.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +sudo apt-get install -y docker.io libvirt-bin virt-manager qemu qemu-efi + +WORKSPACE=`pwd` +if [ ! -d "$WORKSPACE/compass4nfv" ]; then + git clone https://gerrit.opnfv.org/gerrit/compass4nfv +fi + +cd compass4nfv + +WORKSPACE=`pwd` + +COMPASS_WORK_DIR=$WORKSPACE/../compass-work +mkdir -p $COMPASS_WORK_DIR +if [ ! -d "$WORKSPACE/work" ]; then + ln -s $COMPASS_WORK_DIR work +fi + +#TODO: remove workaround after patches merged +if [ ! -f "$WORKSPACE/patched" ]; then + + git checkout a360411cb8c775dffa24a4157cec2b566cbde6f3 + curl http://people.linaro.org/~yibo.cai/compass/0001-deploy-cobbler-drop-tcp_tw_recycle-in-sysctl.conf.patch | git apply || true + curl http://people.linaro.org/~yibo.cai/compass/0002-docker-compose-support-aarch64.patch | git apply || true + curl http://people.linaro.org/~yibo.cai/compass/0003-add-a-multus-with-2-fannel-interfaces-installation.patch | git apply || true + touch "$WORKSPACE/patched" +fi + +# build tarball +COMPASS_ISO_REPO='http://people.linaro.org/~yibo.cai/compass' ./build.sh diff --git a/src/arm/kubernetes_2flannel/k8s-deploy.sh b/src/arm/kubernetes_2flannel/k8s-deploy.sh new file mode 100755 index 0000000..46f7786 --- /dev/null +++ b/src/arm/kubernetes_2flannel/k8s-deploy.sh @@ -0,0 +1,44 @@ +#!/bin/bash +set -e + +#sudo apt-get install -y docker.io libvirt-bin virt-manager qemu qemu-efi + +#!/bin/bash +dir=`pwd` +echo "Current dir: "$dir +curdir=${dir##*/} +result=$(echo $curdir | grep "compass4nfv") +if [[ "$result" == "" ]] +then + cd compass4nfv +fi + +CONTAINER4NFV_SCENARIO=2flannels + +export ADAPTER_OS_PATTERN='(?i)CentOS-7.*arm.*' +export OS_VERSION="centos7" +export KUBERNETES_VERSION="v1.7.3" +export DHA="deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml" +export NETWORK="deploy/conf/vm_environment/network.yml" +export VIRT_NUMBER=2 VIRT_CPUS=2 VIRT_MEM=4096 VIRT_DISK=50G + +if [ $CONTAINER4NFV_SCENARIO = 2flannels ]; then + # enable 2 flannel cni deployment + echo "Set 2flannel scenario" + sed -i.bak 's/^kube_network_plugin:.*$/kube_network_plugin: 2flannel/' \ + deploy/adapters/ansible/kubernetes/roles/kargo/files/extra-vars-aarch64.yml +fi + +./deploy.sh + +set -ex + +# basic test: ssh to master, check k8s node status +sshpass -p root ssh root@10.1.0.50 kubectl get nodes 2>/dev/null | grep -i ready + +# scenario specific tests +if [ $CONTAINER4NFV_SCENARIO = 2flannels ]; then +# show two nics in container + sshpass -p root ssh root@10.1.0.50 \ + kubectl run test-2flannel --rm --restart=Never -it --image=busybox -- ip a +fi diff --git a/src/arm/kubernetes_2flannel/setup.sh b/src/arm/kubernetes_2flannel/setup.sh new file mode 100755 index 0000000..b33e990 --- /dev/null +++ b/src/arm/kubernetes_2flannel/setup.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +./k8s-build.sh + +sleep 2 + +./k8s-deploy.sh -- cgit 1.2.3-korg