-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Start OVS components in containers so that building and shipping of OVS components is easy. 2. Load OVS kernel modules on host from container to avoid installing ovs on host. 3. Update documentation about how to build/run ovs in docker. Acked-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: aginwala <aginwala@ebay.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
- Loading branch information
Showing
8 changed files
with
220 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#export OVS_BRANCH=branch-2.11 | ||
#export OVS_VERSION=2.11 | ||
#export KERNEL_VERSION=4.15.0-54-generic | ||
#export DISTRO=debian | ||
#export GITHUB_SRC=https://github.com/openvswitch/ovs.git | ||
#export DOCKER_REPO=openvswitch/ovs | ||
|
||
# Example: | ||
# make build | ||
# make push | ||
|
||
REPO = ${DOCKER_REPO} | ||
tag = ${OVS_VERSION}_${KERNEL_VERSION} | ||
|
||
build: ;docker build -t ${REPO}:${tag} --build-arg DISTRO=${DISTRO} \ | ||
--build-arg OVS_BRANCH=${OVS_BRANCH} \ | ||
--build-arg KERNEL_VERSION=${KERNEL_VERSION} \ | ||
--build-arg GITHUB_SRC=${GITHUB_SRC} -f ${DISTRO}/Dockerfile . | ||
|
||
.PHONY: build | ||
|
||
push: ;docker push ${REPO}:${tag} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at: | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ovsdb-tool create /etc/openvswitch/conf.db \ | ||
/usr/share/openvswitch/vswitch.ovsschema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM ubuntu:16.04 | ||
MAINTAINER "Aliasgar Ginwala" <aginwala@ebay.com> | ||
|
||
ARG OVS_BRANCH | ||
ARG KERNEL_VERSION | ||
ARG GITHUB_SRC | ||
ARG DISTRO | ||
|
||
copy $DISTRO/build-kernel-modules.sh /build-kernel-modules.sh | ||
RUN /build-kernel-modules.sh $KERNEL_VERSION $OVS_BRANCH $GITHUB_SRC | ||
|
||
COPY create_ovs_db.sh /etc/openvswitch/create_ovs_db.sh | ||
RUN /etc/openvswitch/create_ovs_db.sh | ||
|
||
COPY ovs-override.conf /etc/depmod.d/openvswitch.conf | ||
|
||
COPY start-ovs /bin/start-ovs | ||
VOLUME ["/var/log/openvswitch", "/var/lib/openvswitch",\ | ||
"/var/run/openvswitch", "/etc/openvswitch"] | ||
ENTRYPOINT ["start-ovs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/sh | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at: | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
KERNEL_VERSION=$1 | ||
OVS_BRANCH=$2 | ||
GITHUB_SRC=$3 | ||
|
||
# Install deps | ||
linux="linux-image-$KERNEL_VERSION linux-headers-$KERNEL_VERSION" | ||
build_deps="apt-utils libelf-dev build-essential libssl-dev python \ | ||
python-six wget gdb autoconf libtool git automake bzip2 debhelper \ | ||
dh-autoreconf openssl" | ||
|
||
apt-get update | ||
apt-get install -y ${linux} ${build_deps} | ||
|
||
# get the source | ||
mkdir /build; cd /build | ||
git clone --depth 1 -b $OVS_BRANCH $GITHUB_SRC | ||
cd ovs | ||
|
||
# build and install | ||
./boot.sh | ||
./configure --localstatedir="/var" --sysconfdir="/etc" --prefix="/usr" \ | ||
--with-linux=/lib/modules/$KERNEL_VERSION/build --enable-ssl | ||
make -j8; make install; make modules_install | ||
|
||
# remove deps to make the container light weight. | ||
apt-get remove --purge -y ${build_deps} | ||
apt-get autoremove -y --purge | ||
cd ..; rm -rf ovs | ||
basic_utils="vim kmod net-tools uuid-runtime iproute2" | ||
apt-get install -y ${basic_utils} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
override openvswitch * extra | ||
override vport-geneve * extra | ||
override vport-stt * extra | ||
override vport-* * extra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at: | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
case $1 in | ||
"ovsdb-server") /usr/share/openvswitch/scripts/ovs-ctl start \ | ||
--system-id=random --no-ovs-vswitchd | ||
/usr/share/openvswitch/scripts/ovs-ctl stop | ||
ovsdb-server --pidfile /etc/openvswitch/conf.db \ | ||
-vconsole:emer -vsyslog:err -vfile:info \ | ||
--remote=punix:/var/run/openvswitch/db.sock \ | ||
--private-key=db:Open_vSwitch,SSL,private_key \ | ||
--certificate=db:Open_vSwitch,SSL,certificate \ | ||
--bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \ | ||
--log-file=/var/log/openvswitch/ovsdb-server.log \ | ||
--no-chdir | ||
;; | ||
"ovs-vswitchd") depmod -a | ||
modprobe openvswitch | ||
modprobe vport_stt | ||
modprobe vport_geneve | ||
/usr/share/openvswitch/scripts/ovs-ctl \ | ||
--no-ovsdb-server start | ||
/usr/share/openvswitch/scripts/ovs-ctl \ | ||
--no-ovsdb-server force-reload-kmod | ||
/usr/share/openvswitch/scripts/ovs-ctl stop | ||
ovs-vswitchd --pidfile -vconsole:emer -vsyslog:err \ | ||
-vfile:info --mlockall --no-chdir \ | ||
--log-file=/var/log/openvswitch/ovs-vswitchd.log | ||
;; | ||
*) echo "$0 [ovsdb-server|ovs-vswitchd]" | ||
esac |