summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuo Ruijing <ruijing.guo@intel.com>2017-08-29 13:32:55 -0700
committerGuo Ruijing <ruijing.guo@intel.com>2017-08-30 13:11:41 -0700
commit2b8607df937482d1881f264f85567d6e770dca47 (patch)
tree72196689b6f41ac524e529d7991c769f93029867
parent72a7b3b69735d65c4163bde25b361853700c3007 (diff)
work around local-host ip route issue in ovsdpdk cni
Change-Id: Ia25fb3165aca40ee9b510a5133212b7867c4ef0b Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
-rw-r--r--src/cni/ovsdpdk/kube_cniovsdpdk.yml5
-rwxr-xr-xsrc/cni/ovsdpdk/setup_ovsdpdk.sh2
-rw-r--r--src/vagrant/k8s_kubeadm/Vagrantfile4
-rw-r--r--src/vagrant/k8s_kubeadm/master_setup.sh2
-rw-r--r--src/vagrant/k8s_kubeadm/ovsdpdk/start.sh3
5 files changed, 11 insertions, 5 deletions
diff --git a/src/cni/ovsdpdk/kube_cniovsdpdk.yml b/src/cni/ovsdpdk/kube_cniovsdpdk.yml
index 8e8ed0e..1699f61 100644
--- a/src/cni/ovsdpdk/kube_cniovsdpdk.yml
+++ b/src/cni/ovsdpdk/kube_cniovsdpdk.yml
@@ -21,7 +21,10 @@ data:
"bridge": "br-dpdk",
"ipam": {
"type": "host-local",
- "subnet": "10.244.0.0/16"
+ "subnet": "10.244.0.0/16",
+ "rangeStart": "10.244.0.100",
+ "gateway": "10.244.0.1",
+ "dataDir": "/vagrant/container-ipam-state"
}
}
---
diff --git a/src/cni/ovsdpdk/setup_ovsdpdk.sh b/src/cni/ovsdpdk/setup_ovsdpdk.sh
index a1813c9..6009b7a 100755
--- a/src/cni/ovsdpdk/setup_ovsdpdk.sh
+++ b/src/cni/ovsdpdk/setup_ovsdpdk.sh
@@ -7,8 +7,10 @@ pid=$(echo $netns | cut -f3 -d"/")
sudo ovs-vsctl --may-exist add-br br-dpdk -- set bridge br-dpdk datapath_type=netdev
sudo ovs-vsctl --may-exist add-port br-dpdk vhost-user-$pid -- set Interface vhost-user-$pid type=dpdkvhostuser
+
sudo ln -sf $netns /var/run/netns/$pid
sudo ip link add dummy-$pid type dummy
sudo ip link set dummy-$pid netns $pid
+
sudo mkdir -p /var/run/cni
echo $ip | sudo tee /var/run/cni/netconf-$pid
diff --git a/src/vagrant/k8s_kubeadm/Vagrantfile b/src/vagrant/k8s_kubeadm/Vagrantfile
index 3890e57..f1e7aac 100644
--- a/src/vagrant/k8s_kubeadm/Vagrantfile
+++ b/src/vagrant/k8s_kubeadm/Vagrantfile
@@ -19,7 +19,7 @@ Vagrant.configure("2") do |config|
config.vm.hostname = "master"
config.vm.provision "shell", path: "master_setup.sh", privileged: false
config.vm.network :private_network, ip: "192.168.1.10"
- config.vm.network :private_network, ip: "192.168.2.10"
+ config.vm.network :private_network, ip: "10.244.0.10"
end
(1 .. $num_workers).each do |i|
@@ -27,7 +27,7 @@ Vagrant.configure("2") do |config|
config.vm.hostname = vm_name
config.vm.provision "shell", path: "worker_setup.sh", privileged: false
config.vm.network :private_network, ip: "192.168.1.#{i+20}"
- config.vm.network :private_network, ip: "192.168.2.#{i+20}"
+ config.vm.network :private_network, ip: "10.244.0.#{i+20}"
end
end
diff --git a/src/vagrant/k8s_kubeadm/master_setup.sh b/src/vagrant/k8s_kubeadm/master_setup.sh
index 06785b6..2e56bee 100644
--- a/src/vagrant/k8s_kubeadm/master_setup.sh
+++ b/src/vagrant/k8s_kubeadm/master_setup.sh
@@ -1,7 +1,5 @@
#!/bin/bash
-sudo ifconfig br-dpdk 10.244.0.1/16 up
-
sudo kubeadm init --apiserver-advertise-address 192.168.1.10 --service-cidr=192.168.1.0/24 --pod-network-cidr=10.244.0.0/16 --token 8c5adc.1cec8dbf339093f0
sudo cp /etc/kubernetes/admin.conf $HOME/
sudo chown $(id -u):$(id -g) $HOME/admin.conf
diff --git a/src/vagrant/k8s_kubeadm/ovsdpdk/start.sh b/src/vagrant/k8s_kubeadm/ovsdpdk/start.sh
index d31a242..fed7985 100644
--- a/src/vagrant/k8s_kubeadm/ovsdpdk/start.sh
+++ b/src/vagrant/k8s_kubeadm/ovsdpdk/start.sh
@@ -7,6 +7,7 @@ do
sudo sysctl -w vm.nr_hugepages=2048; sleep 1
done
sudo modprobe uio_pci_generic
+ip=$(ip a s enp0s9 | grep inet | grep -v inet6 | sed "s/.*inet//" | cut -f2 -d' ')
sudo ip address flush enp0s9
sudo /usr/share/dpdk/tools/dpdk_nic_bind.py --bind=uio_pci_generic enp0s9
sudo sysctl -w vm.nr_hugepages=1024
@@ -20,6 +21,8 @@ sudo pkill ovs-vswitchd
sudo ovs-vswitchd --dpdk -c 0x1 -n 2 -m $memory -- unix:/var/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --no-chdir --log-file=/var/log/openvswitch/ovs-vswitchd.log --pidfile=/var/run/openvswitch/ovs-vswitchd.pid --detach --monitor
sudo ovs-vsctl add-br br-dpdk -- set bridge br-dpdk datapath_type=netdev
sudo ovs-vsctl add-port br-dpdk dpdk0 -- set Interface dpdk0 type=dpdk
+sudo ip a a $ip dev br-dpdk
+sudo ip link set dev br-dpdk up
while true; do sleep 3600; done
echo sudo docker build -t openretriever/ubuntu1604-ovsdpdk .
echo sudo docker run -ti --privileged --net=host -v /dev:/dev -v /usr/local/bin:/usr/local/bin -v /var/run/openvswitch/:/var/run/openvswitch/ -v /lib/modules/:/lib/modules openretriever/ubuntu1604-ovsdpdk bash