diff options
Diffstat (limited to 'src/cni/ovsdpdk/cni')
-rw-r--r-- | src/cni/ovsdpdk/cni/install_cni.sh | 8 | ||||
-rwxr-xr-x | src/cni/ovsdpdk/cni/setup_ovsdpdk.sh | 16 | ||||
-rwxr-xr-x | src/cni/ovsdpdk/cni/teardown_ovsdpdk.sh | 9 |
3 files changed, 33 insertions, 0 deletions
diff --git a/src/cni/ovsdpdk/cni/install_cni.sh b/src/cni/ovsdpdk/cni/install_cni.sh new file mode 100644 index 0000000..1996700 --- /dev/null +++ b/src/cni/ovsdpdk/cni/install_cni.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -ex +cp /cni/ovsdpdk /opt/cni/bin +cp /cni/setup_ovsdpdk.sh /opt/cni/bin +cp /cni/teardown_ovsdpdk.sh /opt/cni/bin +cp /etc/kube-cniovsdpdk/cni-conf.json /etc/cni/net.d/10-ovsdpdk.conf +while true; do sleep 3600; done diff --git a/src/cni/ovsdpdk/cni/setup_ovsdpdk.sh b/src/cni/ovsdpdk/cni/setup_ovsdpdk.sh new file mode 100755 index 0000000..6009b7a --- /dev/null +++ b/src/cni/ovsdpdk/cni/setup_ovsdpdk.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +netns=$1 +containerid=$2 +ip=$3 +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/cni/ovsdpdk/cni/teardown_ovsdpdk.sh b/src/cni/ovsdpdk/cni/teardown_ovsdpdk.sh new file mode 100755 index 0000000..857738e --- /dev/null +++ b/src/cni/ovsdpdk/cni/teardown_ovsdpdk.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +netns=$1 +containerid=$2 +pid=$(echo $netns | cut -f3 -d"/") + +sudo ovs-vsctl del-port br-dpdk vhost-user-$pid +sudo ip netns exec $pid link delete dummy-$pid +sudo rm -rf /var/run/cni/netconf-$pid |