diff options
author | Guo Ruijing <ruijing.guo@intel.com> | 2017-11-23 12:58:05 -0500 |
---|---|---|
committer | Guo Ruijing <ruijing.guo@intel.com> | 2017-11-23 16:33:53 -0500 |
commit | a8388222d5d1f11be506e9e79f5e2476c447177e (patch) | |
tree | 59aebeb523399bd3c3132391ad85c3153b779448 /src/vagrant/kubeadm_ovsdpdk | |
parent | ec94abf0ea9154af2f0dbce13e12df775b72bbac (diff) |
build ovsdpdk cni during deployment
Change-Id: I1c3d4b44bab0d75fae93f7fabce7bcfdcc3b9f35
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
Diffstat (limited to 'src/vagrant/kubeadm_ovsdpdk')
-rwxr-xr-x | src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh | 2 | ||||
-rw-r--r-- | src/vagrant/kubeadm_ovsdpdk/master_setup.sh | 2 | ||||
-rw-r--r-- | src/vagrant/kubeadm_ovsdpdk/ovsdpdk/Dockerfile | 8 | ||||
-rw-r--r-- | src/vagrant/kubeadm_ovsdpdk/ovsdpdk/install.sh | 6 | ||||
-rw-r--r-- | src/vagrant/kubeadm_ovsdpdk/ovsdpdk/kube_ovsdpdk.yml | 58 | ||||
-rw-r--r-- | src/vagrant/kubeadm_ovsdpdk/ovsdpdk/start.sh | 28 |
6 files changed, 2 insertions, 102 deletions
diff --git a/src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh b/src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh index dd918de..0cd9d0e 100755 --- a/src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh +++ b/src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh @@ -20,7 +20,7 @@ set -ex kubectl delete rc --all kubectl apply -f /vagrant/examples/virtio-user.yaml r="0" -while [ $r -ne "4" ] +while [ $r -ne "6" ] do r=$(kubectl get pods --all-namespaces | grep ovsdpdk | grep Run | wc -l) sleep 20 diff --git a/src/vagrant/kubeadm_ovsdpdk/master_setup.sh b/src/vagrant/kubeadm_ovsdpdk/master_setup.sh index b9cd5db..ad8538a 100644 --- a/src/vagrant/kubeadm_ovsdpdk/master_setup.sh +++ b/src/vagrant/kubeadm_ovsdpdk/master_setup.sh @@ -8,5 +8,5 @@ sudo chown $(id -u):$(id -g) $HOME/admin.conf export KUBECONFIG=$HOME/admin.conf echo "export KUBECONFIG=$HOME/admin.conf" >> $HOME/.bash_profile -kubectl apply -f /vagrant/ovsdpdk/kube_ovsdpdk.yml +kubectl apply -f /src/cni/ovsdpdk/kube_ovsdpdk.yml kubectl apply -f /src/cni/ovsdpdk/kube_cniovsdpdk.yml diff --git a/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/Dockerfile b/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/Dockerfile deleted file mode 100644 index a63df8f..0000000 --- a/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM ubuntu:16.04 - -WORKDIR /ovsdpdk -RUN apt-get update && apt-get install -y sudo -ADD install.sh . -RUN bash ./install.sh -ADD start.sh . -RUN chmod 755 start.sh diff --git a/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/install.sh b/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/install.sh deleted file mode 100644 index f565025..0000000 --- a/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/install.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -set -ex -sudo apt-get update -sudo apt-get install -y openvswitch-switch-dpdk pciutils vim -sudo update-alternatives --set ovs-vswitchd /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk diff --git a/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/kube_ovsdpdk.yml b/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/kube_ovsdpdk.yml deleted file mode 100644 index ed04ccd..0000000 --- a/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/kube_ovsdpdk.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: ovsdpdk - namespace: kube-system ---- -apiVersion: extensions/v1beta1 -kind: DaemonSet -metadata: - name: kube-ovsdpdk-ds - namespace: kube-system - labels: - tier: node - app: ovsdpdk -spec: - template: - metadata: - labels: - tier: node - app: ovsdpdk - spec: - hostNetwork: true - nodeSelector: - beta.kubernetes.io/arch: amd64 - tolerations: - - key: node-role.kubernetes.io/master - operator: Exists - effect: NoSchedule - serviceAccountName: ovsdpdk - containers: - - name: install-ovsdpdk - image: openretriever/ubuntu1604-ovsdpdk - command: [ "/bin/bash", "/ovsdpdk/start.sh" ] - securityContext: - privileged: true - volumeMounts: - - name: local-bin - mountPath: /usr/local/bin - - name: var-run - mountPath: /var/run/openvswitch - - name: lib-modules - mountPath: /lib/modules - - name: dev-hugepage - mountPath: /dev - volumes: - - name: local-bin - hostPath: - path: /usr/local/bin - - name: var-run - hostPath: - path: /var/run/openvswitch - - name: lib-modules - hostPath: - path: /lib/modules - - name: dev-hugepage - hostPath: - path: /dev diff --git a/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/start.sh b/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/start.sh deleted file mode 100644 index 4fc3d17..0000000 --- a/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/start.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -set -ex - -for i in {1..10} -do - sudo sysctl -w vm.nr_hugepages=2048; sleep 1 -done -sudo modprobe uio_pci_generic -ip=$(ip a s eth2 | grep inet | grep -v inet6 | sed "s/.*inet//" | cut -f2 -d' ') -sudo ip address flush eth2 -sudo /usr/share/dpdk/tools/dpdk_nic_bind.py --bind=uio_pci_generic eth2 -sudo sysctl -w vm.nr_hugepages=1024 -sudo mount -t hugetlbfs -o pagesize=2M none /dev/hugepages -sudo cp /usr/bin/ovs-vsctl /usr/local/bin -memory=$(grep HugePages_Total /proc/meminfo | cut -f2 -d:) -echo "DPDK_OPTS='--dpdk -c 0x1 -n 2 -m $memory'" | sudo tee -a /etc/default/openvswitch-switch -sudo service dpdk restart -sudo service openvswitch-switch restart -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 |