diff options
author | Guo Ruijing <ruijing.guo@intel.com> | 2017-11-26 15:02:37 -0500 |
---|---|---|
committer | Guo Ruijing <ruijing.guo@intel.com> | 2017-11-29 14:28:08 -0500 |
commit | 85999db47c5f2292968c91184021bd220c7cd246 (patch) | |
tree | 46f74b6f63fae35ca2dbc5683bbe0d5560d1589e | |
parent | cc076fe7ba6bdc7b5298ed7b19a15cad37af0307 (diff) |
support vagrant/libvirt
1. add cleanup for libvirt
2. use libvirt for deployments
3. use yk0/ubuntu-xenial box
4. update sleep time to reduce log size
Change-Id: Ie1f0acc6a496180c4d73ade5f724434400fef1f7
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
-rwxr-xr-x | ci/deploy.sh | 1 | ||||
-rwxr-xr-x | src/vagrant/cleanup.sh (renamed from ci/cleanup.sh) | 6 | ||||
-rw-r--r-- | src/vagrant/kubeadm_basic/Vagrantfile | 17 | ||||
-rwxr-xr-x | src/vagrant/kubeadm_basic/deploy.sh | 4 | ||||
-rwxr-xr-x | src/vagrant/kubeadm_basic/examples/nginx-app.sh | 22 | ||||
-rw-r--r-- | src/vagrant/kubeadm_multus/Vagrantfile | 16 | ||||
-rwxr-xr-x | src/vagrant/kubeadm_multus/deploy.sh | 5 | ||||
-rwxr-xr-x | src/vagrant/kubeadm_multus/examples/multus.sh | 4 | ||||
-rw-r--r-- | src/vagrant/kubeadm_ovsdpdk/Vagrantfile | 16 | ||||
-rwxr-xr-x | src/vagrant/kubeadm_ovsdpdk/deploy.sh | 5 | ||||
-rwxr-xr-x | src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh | 8 | ||||
-rw-r--r-- | src/vagrant/kubeadm_virtlet/Vagrantfile | 13 | ||||
-rwxr-xr-x | src/vagrant/kubeadm_virtlet/deploy.sh | 5 | ||||
-rwxr-xr-x | src/vagrant/kubeadm_virtlet/examples/virtlet.sh | 2 |
14 files changed, 64 insertions, 60 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh index 26da62e..7d71ff3 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -17,7 +17,6 @@ set -ex -./cleanup.sh ../src/vagrant/kubeadm_basic/deploy.sh ../src/vagrant/kubeadm_multus/deploy.sh ../src/vagrant/kubeadm_virtlet/deploy.sh diff --git a/ci/cleanup.sh b/src/vagrant/cleanup.sh index afe4ac0..a7d129c 100755 --- a/ci/cleanup.sh +++ b/src/vagrant/cleanup.sh @@ -21,3 +21,9 @@ VBoxManage list vms | cut -f2 -d'"' | xargs -I {} VBoxManage controlvm {} powero VBoxManage list vms | cut -f2 -d'"' | xargs -I {} VBoxManage unregistervm {} --delete VBoxManage list hostonlyifs | grep "^Name:.*vboxnet" |\ sed "s/^Name:.*vboxnet/vboxnet/" | xargs -I {} VBoxManage hostonlyif remove {} +sudo virsh list --name | xargs -I {} sudo virsh destroy {} +sudo virsh list --all --name | xargs -I {} sudo virsh undefine {} +sudo virsh net-list --name | xargs -I {} sudo virsh net-destroy --network {} +sudo virsh net-list --name | xargs -I {} sudo virsh undefine {} +sudo brctl show | awk 'NF>1 && NR>1 {print $1}' | xargs -I {} sudo bash -c "ifconfig {} down; brctl delbr {}" +sudo virsh vol-list default | awk 'NF>1 && NR>1 {print $1}' | xargs -I {} sudo virsh vol-delete {} default diff --git a/src/vagrant/kubeadm_basic/Vagrantfile b/src/vagrant/kubeadm_basic/Vagrantfile index 063e802..abb71c4 100644 --- a/src/vagrant/kubeadm_basic/Vagrantfile +++ b/src/vagrant/kubeadm_basic/Vagrantfile @@ -3,20 +3,15 @@ $num_workers=2 Vagrant.require_version ">= 1.8.6" Vagrant.configure("2") do |config| - config.vm.box = "opnfv/container4nfv" - config.vm.box_version = "0" + config.vm.box = "yk0/ubuntu-xenial" + config.vm.provider :libvirt do |libvirt| + libvirt.memory = 4096 + libvirt.cpus = 4 + end + config.vm.synced_folder "../..", "/src" config.vm.provision "shell", path: "host_setup.sh", privileged: false - config.vm.provider :virtualbox do |vb| - vb.customize ["modifyvm", :id, "--memory", 4096] - vb.customize ["modifyvm", :id, "--cpus", 4] - vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"] - vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"] - vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"] - vb.customize "post-boot",["controlvm", :id, "setlinkstate1", "on"] - end - config.vm.define "master" do |config| config.vm.hostname = "master" config.vm.provision "shell", path: "master_setup.sh", privileged: false diff --git a/src/vagrant/kubeadm_basic/deploy.sh b/src/vagrant/kubeadm_basic/deploy.sh index 4e12e91..89c4f40 100755 --- a/src/vagrant/kubeadm_basic/deploy.sh +++ b/src/vagrant/kubeadm_basic/deploy.sh @@ -4,6 +4,6 @@ set -ex DIR="$(dirname `readlink -f $0`)" cd $DIR +../cleanup.sh vagrant up -vagrant ssh master -c "/vagrant/examples/nginx-app.sh" || (vagrant destroy -f; exit 1) -vagrant destroy -f +vagrant ssh master -c "/vagrant/examples/nginx-app.sh" diff --git a/src/vagrant/kubeadm_basic/examples/nginx-app.sh b/src/vagrant/kubeadm_basic/examples/nginx-app.sh index 07b9c22..ada4306 100755 --- a/src/vagrant/kubeadm_basic/examples/nginx-app.sh +++ b/src/vagrant/kubeadm_basic/examples/nginx-app.sh @@ -1,4 +1,21 @@ -#!/usr/bin/env bash +#!/bin/bash +# +# Copyright (c) 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -ex kubectl create -f /vagrant/examples/nginx-app.yaml kubectl get nodes @@ -10,10 +27,11 @@ r="0" while [ $r -ne "2" ] do r=$(kubectl get pods | grep Running | wc -l) - sleep 20 + sleep 60 done svcip=$(kubectl get services nginx -o json | grep clusterIP | cut -f4 -d'"') +sleep 10 wget http://$svcip kubectl delete rc --all kubectl delete services --all diff --git a/src/vagrant/kubeadm_multus/Vagrantfile b/src/vagrant/kubeadm_multus/Vagrantfile index bda421f..2007519 100644 --- a/src/vagrant/kubeadm_multus/Vagrantfile +++ b/src/vagrant/kubeadm_multus/Vagrantfile @@ -3,17 +3,13 @@ $num_workers=2 Vagrant.require_version ">= 1.8.6" Vagrant.configure("2") do |config| - config.vm.box = "opnfv/container4nfv" - config.vm.box_version = "0" - config.vm.synced_folder "../..", "/src" - config.vm.provision "shell", path: "host_setup.sh", privileged: false - config.vm.provider :virtualbox do |vb| - vb.customize ["modifyvm", :id, "--memory", 4096] - vb.customize ["modifyvm", :id, "--cpus", 4] - vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"] - vb.customize "post-boot",["controlvm", :id, "setlinkstate1", "on"] + config.vm.box = "yk0/ubuntu-xenial" + config.vm.provider :libvirt do |libvirt| + libvirt.memory = 4096 + libvirt.cpus = 4 end - + + config.vm.synced_folder "../..", "/src" config.vm.provision "shell", path: "host_setup.sh", privileged: false config.vm.define "master" do |config| diff --git a/src/vagrant/kubeadm_multus/deploy.sh b/src/vagrant/kubeadm_multus/deploy.sh index a0e7843..9c9e51e 100755 --- a/src/vagrant/kubeadm_multus/deploy.sh +++ b/src/vagrant/kubeadm_multus/deploy.sh @@ -4,7 +4,6 @@ set -ex DIR="$(dirname `readlink -f $0`)" cd $DIR -vagrant destroy -f +../cleanup.sh vagrant up -vagrant ssh master -c "/vagrant/examples/multus.sh" || (vagrant destroy -f; exit 1) -vagrant destroy -f +vagrant ssh master -c "/vagrant/examples/multus.sh" diff --git a/src/vagrant/kubeadm_multus/examples/multus.sh b/src/vagrant/kubeadm_multus/examples/multus.sh index 92e95ab..d7b39a0 100755 --- a/src/vagrant/kubeadm_multus/examples/multus.sh +++ b/src/vagrant/kubeadm_multus/examples/multus.sh @@ -20,7 +20,7 @@ set -ex while true do kubectl get pods -n kube-system | grep kube-cnimultus-ds | grep -v Run | wc -l | grep "^0$" && break - sleep 20 + sleep 60 done kubectl delete rc --all @@ -28,8 +28,8 @@ kubectl apply -f /vagrant/examples/busybox.yaml r="0" while [ $r -ne "2" ] do - sleep 10 r=$(kubectl get pods | grep Running | wc -l) + sleep 60 done kubectl get pods --all-namespaces diff --git a/src/vagrant/kubeadm_ovsdpdk/Vagrantfile b/src/vagrant/kubeadm_ovsdpdk/Vagrantfile index 2d69109..5d51e5a 100644 --- a/src/vagrant/kubeadm_ovsdpdk/Vagrantfile +++ b/src/vagrant/kubeadm_ovsdpdk/Vagrantfile @@ -3,18 +3,14 @@ $num_workers=2 Vagrant.require_version ">= 1.8.6" Vagrant.configure("2") do |config| - config.vm.box = "opnfv/container4nfv" - config.vm.box_version = "0" + config.vm.box = "yk0/ubuntu-xenial" + config.vm.provider :libvirt do |libvirt| + libvirt.memory = 4096 + libvirt.cpus = 4 + end + config.vm.synced_folder "../..", "/src" config.vm.provision "shell", path: "host_setup.sh", privileged: false - config.vm.provider :virtualbox do |vb| - vb.customize ["modifyvm", :id, "--memory", 4096] - vb.customize ["modifyvm", :id, "--cpus", 4] - vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"] - vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"] - vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"] - vb.customize "post-boot",["controlvm", :id, "setlinkstate1", "on"] - end config.vm.define "master" do |config| config.vm.hostname = "master" diff --git a/src/vagrant/kubeadm_ovsdpdk/deploy.sh b/src/vagrant/kubeadm_ovsdpdk/deploy.sh index 2cf96b9..2a32d28 100755 --- a/src/vagrant/kubeadm_ovsdpdk/deploy.sh +++ b/src/vagrant/kubeadm_ovsdpdk/deploy.sh @@ -4,8 +4,7 @@ set -ex DIR="$(dirname `readlink -f $0`)" cd $DIR -vagrant destroy -f +../cleanup.sh rm -rf container-ipam-state vagrant up -vagrant ssh master -c "/vagrant/examples/virtio-user.sh" || (vagrant destroy -f; exit 1) -vagrant destroy -f +vagrant ssh master -c "/vagrant/examples/virtio-user.sh" diff --git a/src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh b/src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh index 0cd9d0e..c208300 100755 --- a/src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh +++ b/src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh @@ -23,7 +23,7 @@ r="0" while [ $r -ne "6" ] do r=$(kubectl get pods --all-namespaces | grep ovsdpdk | grep Run | wc -l) - sleep 20 + sleep 60 done kubectl delete rc --all @@ -32,8 +32,8 @@ r="0" while [ $r -ne "2" ] do r=$(kubectl get pods | grep Running | wc -l) - sleep 20 + sleep 60 done kubectl get pods --all-namespaces -sleep 20 -ping -c4 10.244.0.103 || ping -c4 10.244.0.104 +sleep 60 +kubectl get pods -o wide | awk 'NF>1 && NR>1 {print $1}' | xargs -I {} kubectl exec -i {} vppctl ping 10.244.0.10 diff --git a/src/vagrant/kubeadm_virtlet/Vagrantfile b/src/vagrant/kubeadm_virtlet/Vagrantfile index 1cc8e58..83c66d4 100644 --- a/src/vagrant/kubeadm_virtlet/Vagrantfile +++ b/src/vagrant/kubeadm_virtlet/Vagrantfile @@ -3,16 +3,13 @@ $num_workers=2 Vagrant.require_version ">= 1.8.6" Vagrant.configure("2") do |config| - config.vm.box = "opnfv/container4nfv" - config.vm.box_version = "0" - config.vm.provision "shell", path: "host_setup.sh", privileged: false - config.vm.provider :virtualbox do |vb| - vb.customize ["modifyvm", :id, "--memory", 4096] - vb.customize ["modifyvm", :id, "--cpus", 4] - vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"] - vb.customize "post-boot",["controlvm", :id, "setlinkstate1", "on"] + config.vm.box = "yk0/ubuntu-xenial" + config.vm.provider :libvirt do |libvirt| + libvirt.memory = 4096 + libvirt.cpus = 4 end + config.vm.synced_folder "../..", "/src" config.vm.provision "shell", path: "host_setup.sh", privileged: false config.vm.define "master" do |config| diff --git a/src/vagrant/kubeadm_virtlet/deploy.sh b/src/vagrant/kubeadm_virtlet/deploy.sh index 758abb5..c2540a8 100755 --- a/src/vagrant/kubeadm_virtlet/deploy.sh +++ b/src/vagrant/kubeadm_virtlet/deploy.sh @@ -4,7 +4,6 @@ set -ex DIR="$(dirname `readlink -f $0`)" cd $DIR -vagrant destroy -f +../cleanup.sh vagrant up -vagrant ssh master -c "/vagrant/examples/virtlet.sh" || (vagrant destroy -f; exit 1) -vagrant destroy -f +vagrant ssh master -c "/vagrant/examples/virtlet.sh" diff --git a/src/vagrant/kubeadm_virtlet/examples/virtlet.sh b/src/vagrant/kubeadm_virtlet/examples/virtlet.sh index 70bb606..cac1882 100755 --- a/src/vagrant/kubeadm_virtlet/examples/virtlet.sh +++ b/src/vagrant/kubeadm_virtlet/examples/virtlet.sh @@ -14,7 +14,7 @@ r="0" while [ $r -ne "1" ] do r=$(kubectl get pods | grep Running | wc -l) - sleep 20 + sleep 60 done sleep 60 kubectl get pods -o json | grep podIP | cut -f4 -d'"' | xargs ping -c 4 |