Skip to content

Commit 3ee2965

Browse files
committed
Openvswitch image build
Dockerfile to build Openvswitch image The Kuryr driver for Swarm bay requires Openvswitch and the Neutron L2 agent running on the nodes. Since the Fedora Atomic does not have these packages installed and it is preferrable to not use a custom-built image, we need to run these packages in a container. This Dockerfile is used to build the Docker image hosted on Docker Hub: openstackmagnum/fedora23-neutron-ovs:testing Partially implements: blueprint kuryr-swarm-integration Change-Id: I5132ccc2bc5660aa9688430bbc51f6759f6b7a81
1 parent 43ea1ab commit 3ee2965

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM fedora:23
2+
MAINTAINER Ton Ngo "[email protected]"
3+
WORKDIR /
4+
RUN dnf -y install openvswitch \
5+
openstack-neutron-ml2 \
6+
openstack-neutron-openvswitch \
7+
bridge-utils \
8+
git \
9+
&& dnf clean all
10+
RUN cd /opt \
11+
&& git clone https://git.openstack.org/openstack/neutron \
12+
&& cp neutron/etc/policy.json /etc/neutron/. \
13+
&& rm -rf neutron \
14+
&& dnf -y remove git
15+
VOLUME /var/run/openvswitch
16+
ADD run_openvswitch_neutron.sh /usr/bin/run_openvswitch_neutron.sh
17+
18+
CMD ["/usr/bin/run_openvswitch_neutron.sh"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
===================
2+
Neutron Openvswitch
3+
===================
4+
5+
This Dockerfile creates a Docker image based on Fedora 23 that runs
6+
Openvswitch and the Neutron L2 agent for Openvswitch. This container
7+
image is used by Magnum when a Swarm cluster is deployed with the
8+
attribute::
9+
10+
--network-driver=kuryr
11+
12+
Magnum deploys this container on each Swarm node along with the
13+
Kuryr container to support Docker advanced networking based on
14+
the `Container Networking Model
15+
<https://github.com/docker/libnetwork/blob/master/docs/design.md>`_.
16+
17+
To build the image, run this command in the same directory as the
18+
Dockerfile::
19+
20+
docker build -t openstackmagnum/fedora23-neutron-ovs:testing .
21+
22+
This image is available on Docker Hub as::
23+
24+
openstackmagnum/fedora23-neutron-ovs:testing
25+
26+
To update the image with a new build::
27+
28+
docker push openstackmagnum/fedora23-neutron-ovs:testing
29+
30+
The 'testing' tag may be replaced with 'latest' or other tag as
31+
needed.
32+
33+
This image is intended to run on the Fedora Atomic public image which
34+
by default does not have these packages installed. The common
35+
practice for Atomic OS is to run new packages in containers rather
36+
than installing them in the OS.
37+
38+
For the Neutron agent, you will need to provide 3 files at these
39+
locations:
40+
41+
- /etc/neutron/neutron.conf
42+
- /etc/neutron/policy.json
43+
- /etc/neutron/plugins/ml2/ml2_conf.ini
44+
45+
These files are typically installed in the same locations on the
46+
Neutron controller node. The policy.json file is copied into the
47+
Docker image because it is fairly static and does not require
48+
customization for the bay. If it is changed in the Neutron master
49+
repo, you just need to rebuild the Docker image to update the file.
50+
Magnum will create the other 2 files on each bay node in the
51+
directory /etc/kuryr and map them to the proper directories in
52+
the container using the Docker -v option.
53+
54+
Since Openvswitch needs to operate on the host network name space,
55+
the Docker container will need the -net=host option.
56+
The /var/run/openvswitch directory is also mapped to the bay node
57+
so that the Kuryr container can talk to openvswitch.
58+
To run the image from Fedora Atomic::
59+
60+
docker run --net=host \
61+
--cap-add=NET_ADMIN \
62+
--privileged=true \
63+
-v /var/run/openvswitch:/var/run/openvswitch \
64+
-v /lib/modules:/lib/modules:ro \
65+
-v /etc/kuryr/neutron.conf:/etc/neutron/neutron.conf \
66+
-v /etc/kuryr/ml2_conf.ini:/etc/neutron/plugins/ml2/ml2_conf.ini \
67+
--name openvswitch-agent \
68+
openstackmagnum/fedora23-neutron-ovs:testing
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
/usr/share/openvswitch/scripts/ovs-ctl start --system-id=random
4+
/usr/bin/neutron-openvswitch-agent --config-file /etc/neutron/neutron.conf --log-file /var/log/neutron/openvswitch-agent.log

0 commit comments

Comments
 (0)