Skip to content

Commit

Permalink
Add OVS-DPDK support, for issue 104
Browse files Browse the repository at this point in the history
This commit adds OVS-DPDK support to Kube-OVN. User instructions are
included in a new file docs/dpdk.md

A new Dockerfile has been added to include OVS-DPDK along with OVN.
Where DPDK is required, this image is used for the ovs-ovn pod, in
place of the existing kernel-OVS “kube-ovn” image. This Dockerfile is
currently based on Fedora 32 for reasons noted as comments within the
file. It should later be possible to change this to CentOS when full
DPDK 19 support is available.

I recommend the above Dockerfile is built and tagged as
kube-ovn-dpdk:<version>, where the version corresponds to the DPDK
version used within the image (in this case 19:11) rather than the
Kube-OVN version. I recommend this as DPDK applications have a strong
dependency on DPDK version. If we force an end user to always use the
latest version, then we will likely break their DPDK app. I propose
over time we provide images for multiple DPDK versions and let the user
pick to suit their needs. I don’t see these images or Dockerfiles
requiring maintenance or support. They should be completely independent
of Kube-OVN versions and releases.

The install.sh script has been modified. It now takes a flag
--with-dpdk=<version> so the user can indicate they want to install
OVS-DPDK based on which version of DPDK. Version of DPDK required will
determine version of OVS and this will be already built into the Docker
image provided. The Kube-OVN version installed is still set at the top
of the script as the VERSION variable. This should still be the case
going forward, Kube-OVN and DPDK versions should operate independently
of each other. However, it’s something to watch. If future versions of
Kube-OVN have a strong dependency on newer versions of OVS, then the
older version of OVS used for DPDK may become an issue. We may have to
update the install script so a user wanting an older version of DPDK
has no choice but to use an older version of Kube-OVN that’s known to
be compatible. I don’t foresee this being an issue, but one to watch as
I said.

New startup and healthcheck scripts added for OVS-DPDK.
  • Loading branch information
garyloug committed May 28, 2020
1 parent 6c982ce commit b055cc6
Show file tree
Hide file tree
Showing 5 changed files with 702 additions and 1 deletion.
72 changes: 72 additions & 0 deletions dist/images/Dockerfile.dpdk1911
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# NOTE: At time of writing, CentOS 8 does not have dpdk-devel v19.11 in the Yum repo.
# This package is required to build the OVS-DPDK RPMs and is available in Fedora 32.
FROM fedora:32

ENV RPM_ARCH=x86_64
ENV ARCH=amd64

ENV OVN_VERSION=20.03
ENV OVS_VERSION=2.13.0

ENV DPDK_VERSION=19.11.1
ENV DPDK_TARGET=x86_64-native-linuxapp-gcc

ENV OVN_DIR=/usr/src/ovn
ENV OVS_DIR=/usr/src/openvswitch-${OVS_VERSION}
ENV DPDK_DIR=/usr/src/dpdk-stable-${DPDK_VERSION}

ENV PATH=${PATH}:/usr/share/openvswitch/scripts
ENV PATH=${PATH}:/usr/share/ovn/scripts/

RUN dnf install -y wget xz git make numactl-devel diffutils dnf-plugins-core dpdk-devel libcap-ng-devel libpcap-devel nc iptables ipset hostname && dnf clean all

# NOTE: Fedora 32 comes with gcc version 10. This caused LD linker issues during DPDK build.
# Install gcc version 9 and its dependencies.
RUN mkdir /rpms && cd /rpms
RUN wget https://kojipkgs.fedoraproject.org//packages/gcc/9.2.1/1.fc32.3/x86_64/cpp-9.2.1-1.fc32.3.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/gcc/9.2.1/1.fc32.3/x86_64/libgomp-9.2.1-1.fc32.3.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/gcc/9.2.1/1.fc32.3/x86_64/gcc-9.2.1-1.fc32.3.x86_64.rpm
RUN dnf install -y cpp-9.2.1-1.fc32.3.x86_64.rpm libgomp-9.2.1-1.fc32.3.x86_64.rpm gcc-9.2.1-1.fc32.3.x86_64.rpm
RUN rm -f cpp-9.2.1-1.fc32.3.x86_64.rpm libgomp-9.2.1-1.fc32.3.x86_64.rpm gcc-9.2.1-1.fc32.3.x86_64.rpm

# Install DPDK
RUN cd /usr/src/ && \
wget http://fast.dpdk.org/rel/dpdk-${DPDK_VERSION}.tar.xz && \
tar xf dpdk-${DPDK_VERSION}.tar.xz && \
rm -f dpdk-${DPDK_VERSION}.tar.xz && \
cd ${DPDK_DIR} && \
sed -i s/CONFIG_RTE_EAL_IGB_UIO=y/CONFIG_RTE_EAL_IGB_UIO=n/ config/common_linux && \
sed -i s/CONFIG_RTE_LIBRTE_KNI=y/CONFIG_RTE_LIBRTE_KNI=n/ config/common_linux && \
sed -i s/CONFIG_RTE_KNI_KMOD=y/CONFIG_RTE_KNI_KMOD=n/ config/common_linux && \
make install T=${DPDK_TARGET} DESTDIR=install

# Install OVS-DPDK
# NOTE: rpm-build is installed here, as installing it earlier conflicts with the workaround to roll back the gcc version.
RUN dnf install -y rpm-build
RUN cd /usr/src/ && \
wget https://www.openvswitch.org/releases/openvswitch-${OVS_VERSION}.tar.gz && \
tar xf openvswitch-${OVS_VERSION}.tar.gz && \
rm -f openvswitch-${OVS_VERSION}.tar.gz && \
cd ${OVS_DIR} && \
sed -e 's/@VERSION@/0.0.1/' rhel/openvswitch-fedora.spec.in > /tmp/ovs.spec && \
dnf builddep -y /tmp/ovs.spec && \
./boot.sh && \
./configure --prefix=/usr/ --with-dpdk=${DPDK_DIR}/${DPDK_TARGET} && \
make rpm-fedora RPMBUILD_OPT="--with dpdk --without check"

# Install OVN
RUN cd /usr/src/ && \
git clone -b branch-${OVN_VERSION} --depth=1 https://github.com/ovn-org/ovn.git && \
cd ovn && \
./boot.sh && \
./configure --with-ovs-source=${OVS_DIR} && \
make rpm-fedora

RUN cp ${OVS_DIR}/rpm/rpmbuild/RPMS/${RPM_ARCH}/* ${OVN_DIR}/rpm/rpmbuild/RPMS/${RPM_ARCH}/* /rpms

RUN mkdir -p /var/run/openvswitch && \
mkdir -p /var/run/ovn

RUN rpm -ivh --nodeps /rpms/*.rpm

COPY *.sh /kube-ovn/

0 comments on commit b055cc6

Please sign in to comment.