#
# This is the OpenShift ovn overlay network image.
# it provides an overlay network using ovs/ovn/ovn-kube
#
# The standard name for this image is ovn-kube

# Notes:
# This is for a development build where the ovn-kubernetes utilities
# are built locally and included in the image (instead of the rpm)

FROM rhel7

USER root

ENV PYTHONDONTWRITEBYTECODE yes

RUN yum install -y  \
	PyYAML bind-utils \
	libnuma.so \
	openssl \
	numactl-libs \
	firewalld-filesystem \
	libpcap \
	openvswitch openvswitch-ovn-common openvswitch-ovn-central \
	openvswitch-ovn-host openvswitch-ovn-vtep openvswitch-devel \
	containernetworking-cni \
	iproute strace socat && \
	yum clean all

RUN mkdir -p /var/run/openvswitch
RUN mkdir -p /etc/cni/net.d
RUN mkdir -p /opt/cni/bin

# Built in ../../go_controller, then the binaries are copied here.
# put things where they are in the rpm
RUN mkdir -p /usr/libexec/cni/
COPY ovn-k8s-overlay ovnkube ovn-kube-util /usr/bin/
COPY ovn-k8s-cni-overlay /usr/libexec/cni/ovn-k8s-cni-overlay

# ovnkube.sh is the entry point. This script examines environment
# variables to direct operation and configure ovn
COPY ovnkube.sh /root/
COPY ovn-debug.sh /root/
# override the rpm's ovn_k8s.conf with this local copy
COPY ovn_k8s.conf /etc/openvswitch/ovn_k8s.conf

WORKDIR /root
ENTRYPOINT /root/ovnkube.sh
