Skip to content

Commit

Permalink
chore: add scripts to build ovs
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Mar 26, 2020
1 parent 62b4763 commit 131181c
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 22 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ build-go:
CGO_ENABLED=0 GOOS=linux go build -o $(PWD)/dist/images/kube-ovn-webhook -ldflags "-w -s" -v ./cmd/webhook
CGO_ENABLED=0 GOOS=linux go build -o $(PWD)/dist/images/kube-ovn-pinger -ldflags "-w -s" -v ./cmd/pinger

ovs:
docker build -t ovs:latest -f dist/ovs/Dockerfile dist/ovs/

release: lint build-go
docker build -t ${REGISTRY}/kube-ovn:${RELEASE_TAG} -f dist/images/Dockerfile dist/images/

Expand Down
23 changes: 1 addition & 22 deletions dist/images/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
FROM centos:7

ENV PYTHONDONTWRITEBYTECODE yes

RUN yum install -y \
bind-utils \
numactl-libs \
firewalld-filesystem \
libpcap \
hostname \
iproute strace socat nc \
unbound unbound-devel \
tcpdump ipset && yum clean all

ENV OVS_VERSION=20.03.0
ENV OVS_SUBVERSION=1

RUN rpm -ivh --nodeps https://github.com/alauda/ovs/releases/download/${OVS_VERSION}-${OVS_SUBVERSION}/openvswitch-${OVS_VERSION}-${OVS_SUBVERSION}.el7.x86_64.rpm && \
rpm -ivh --nodeps https://github.com/alauda/ovs/releases/download/${OVS_VERSION}-${OVS_SUBVERSION}/openvswitch-devel-${OVS_VERSION}-${OVS_SUBVERSION}.el7.x86_64.rpm && \
rpm -ivh --nodeps https://github.com/alauda/ovs/releases/download/${OVS_VERSION}-${OVS_SUBVERSION}/ovn-${OVS_VERSION}-${OVS_SUBVERSION}.el7.x86_64.rpm && \
rpm -ivh --nodeps https://github.com/alauda/ovs/releases/download/${OVS_VERSION}-${OVS_SUBVERSION}/ovn-central-${OVS_VERSION}-${OVS_SUBVERSION}.el7.x86_64.rpm && \
rpm -ivh --nodeps https://github.com/alauda/ovs/releases/download/${OVS_VERSION}-${OVS_SUBVERSION}/ovn-host-${OVS_VERSION}-${OVS_SUBVERSION}.el7.x86_64.rpm
FROM ovs:latest

RUN mkdir -p /var/run/openvswitch && \
mkdir -p /var/run/ovn && \
Expand Down
31 changes: 31 additions & 0 deletions dist/ovs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM centos:8 as ovs-rpm

RUN yum install dnf-plugins-core -y && \
yum config-manager --set-enabled PowerTools && \
yum install python36 git wget openssl-devel gcc \
make python3-devel openssl-devel kernel-devel kernel-debug-devel \
autoconf automake rpm-build redhat-rpm-config libtool libcap-ng-devel \
checkpolicy selinux-policy-devel unbound unbound-devel gcc-c++ \
desktop-file-utils graphviz groff python3-sphinx -y
COPY build.sh /root/build.sh
RUN bash /root/build.sh
ENV ARCH x86_64
RUN mkdir /rpms/ && \
cp /ovs/rpm/rpmbuild/RPMS/${ARCH}/* /ovn/rpm/rpmbuild/RPMS/${ARCH}/* /rpms && \
cd /rpms && rm -f *debug* *docker* *vtep* *ipsec*


FROM centos:8

RUN yum install -y \
bind-utils \
numactl-libs \
firewalld-filesystem \
iptables \
libpcap \
hostname \
iproute strace socat nc \
unbound unbound-devel \
tcpdump ipset && yum clean all
COPY --from=ovs-rpm /rpms/* /rpms/
RUN rpm -ivh --nodeps /rpms/*
30 changes: 30 additions & 0 deletions dist/ovs/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail

wget https://github.com/jemalloc/jemalloc/archive/5.2.1.tar.gz
tar -zxvf 5.2.1.tar.gz
cd jemalloc-5.2.1
./autogen.sh
make dist
make && make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/other.conf
/sbin/ldconfig
cd ..

git clone -b branch-2.13 --depth=1 https://github.com/openvswitch/ovs.git
cd ovs
curl https://github.com/alauda/ovs/commit/238003290766808ba310e1875157b3d414245603.patch | git apply
sed -i 's/2.13.1/2.13.0/g' configure.ac
sed -i 's/sphinx-build-3/sphinx-build/g' rhel/openvswitch-fedora.spec.in
./boot.sh
./configure LIBS=-ljemalloc
make rpm-fedora
cd ..

git clone -b branch-20.03 --depth=1 https://github.com/ovn-org/ovn.git
cd ovn
curl https://github.com/alauda/ovn/commit/19e802b80c866089af8f7a21512f68decc75a874.patch | git apply
sed -i 's/20.03.1/20.03.0/g' configure.ac
./boot.sh
./configure LIBS=-ljemalloc --with-ovs-source=/ovs
make rpm-fedora

0 comments on commit 131181c

Please sign in to comment.