adding centos 8 dockerfile for ovn & ovn4k8s-nfv images 55/71155/5
authorKuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>
Wed, 16 Sep 2020 22:14:13 +0000 (15:14 -0700)
committerKuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>
Fri, 18 Sep 2020 00:10:02 +0000 (17:10 -0700)
Signed-off-by: Kuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>
Change-Id: Ib161ea39fc6da9a7649142271a781b3140068d15

build/Dockerfile.centos [new file with mode: 0644]
build/Dockerfile.ubuntu [moved from build/Dockerfile with 100% similarity]
utilities/docker/centos/Dockerfile [new file with mode: 0644]
utilities/docker/ovn4nfv-k8s.sh [moved from utilities/docker/debian/ovn4nfv-k8s.sh with 87% similarity]

diff --git a/build/Dockerfile.centos b/build/Dockerfile.centos
new file mode 100644 (file)
index 0000000..0b0de04
--- /dev/null
@@ -0,0 +1,49 @@
+FROM centos:8
+
+ARG HTTP_PROXY=${HTTP_PROXY}
+ARG HTTPS_PROXY=${HTTPS_PROXY}
+
+ENV http_proxy $HTTP_PROXY
+ENV https_proxy $HTTPS_PROXY
+ENV no_proxy $NO_PROXY
+
+RUN yum update -y && yum install -y -qq make curl net-tools iproute iptables \
+    wget nc jq ipset unbound unbound-devel
+
+RUN mkdir -p /opt/ovn4nfv-k8s-plugin/ovs/rpm/rpmbuild/RPMS/x86_64
+RUN bash -xc "\
+pushd /opt/ovn4nfv-k8s-plugin/ovs/rpm/rpmbuild/RPMS/x86_64; \
+wget -q -nv -O- https://api.github.com/repos/akraino-icn/ovs/releases/tags/v2.14.0 2>/dev/null | jq -r '.assets[] | select(.browser_download_url | contains("\""rpm"\"")) | .browser_download_url' | wget -i -; \
+popd; \
+"
+RUN rpm -ivh --nodeps /opt/ovn4nfv-k8s-plugin/ovs/rpm/rpmbuild/RPMS/x86_64/*.rpm
+
+RUN mkdir -p /opt/ovn4nfv-k8s-plugin/ovn/rpm/rpmbuild/RPMS/x86_64
+RUN bash -xc "\
+pushd /opt/ovn4nfv-k8s-plugin/ovn/rpm/rpmbuild/RPMS/x86_64; \
+wget -q -nv -O- https://api.github.com/repos/akraino-icn/ovn/releases/tags/v20.06.0 2>/dev/null | jq -r '.assets[] | select(.browser_download_url | contains("\""rpm"\"")) | .browser_download_url' | wget -i -; \
+popd; \
+"
+RUN rpm -ivh --nodeps /opt/ovn4nfv-k8s-plugin/ovn/rpm/rpmbuild/RPMS/x86_64/*.rpm
+
+ENV GOLANG_VERSION 1.14.1
+RUN curl -sSL https://storage.googleapis.com/golang/go$GOLANG_VERSION.linux-amd64.tar.gz \
+        | tar -v -C /usr/local -xz
+
+ENV PATH /usr/local/go/bin:$PATH
+RUN mkdir -p /go/src /go/bin && chmod -R 777 /go
+ENV GOROOT /usr/local/go
+ENV GOPATH /go
+ENV PATH /go/bin:$PATH
+
+WORKDIR /go/src/github.com/opnfv/ovn4nfv-k8s-plugin
+COPY . .
+RUN make all
+
+ENV OPERATOR=/usr/local/bin/nfn-operator \
+    AGENT=/usr/local/bin/nfn-agent \
+    USER_UID=1001 \
+    USER_NAME=nfn-operator
+
+RUN cp -r build/bin/* /usr/local/bin/
+ENTRYPOINT ["entrypoint"]
similarity index 100%
rename from build/Dockerfile
rename to build/Dockerfile.ubuntu
diff --git a/utilities/docker/centos/Dockerfile b/utilities/docker/centos/Dockerfile
new file mode 100644 (file)
index 0000000..7a8f443
--- /dev/null
@@ -0,0 +1,29 @@
+FROM centos:8 as base
+
+USER root
+RUN yum update -y && yum install -y iproute curl nc ipset iptables jq wget unbound unbound-devel
+
+RUN mkdir -p /opt/ovn4nfv-k8s-plugin/ovs/rpm/rpmbuild/RPMS/x86_64
+RUN bash -xc "\
+pushd /opt/ovn4nfv-k8s-plugin/ovs/rpm/rpmbuild/RPMS/x86_64; \
+wget -q -nv -O- https://api.github.com/repos/akraino-icn/ovs/releases/tags/v2.14.0 2>/dev/null | jq -r '.assets[] | select(.browser_download_url | contains("\""rpm"\"")) | .browser_download_url' | wget -i -; \
+popd; \
+"
+RUN rpm -ivh --nodeps /opt/ovn4nfv-k8s-plugin/ovs/rpm/rpmbuild/RPMS/x86_64/*.rpm
+
+RUN mkdir -p /opt/ovn4nfv-k8s-plugin/ovn/rpm/rpmbuild/RPMS/x86_64
+RUN bash -xc "\
+pushd /opt/ovn4nfv-k8s-plugin/ovn/rpm/rpmbuild/RPMS/x86_64; \
+wget -q -nv -O- https://api.github.com/repos/akraino-icn/ovn/releases/tags/v20.06.0 2>/dev/null | jq -r '.assets[] | select(.browser_download_url | contains("\""rpm"\"")) | .browser_download_url' | wget -i -; \
+popd; \
+"
+RUN rpm -ivh --nodeps /opt/ovn4nfv-k8s-plugin/ovn/rpm/rpmbuild/RPMS/x86_64/*.rpm
+
+RUN mkdir -p /var/run/openvswitch && \
+    mkdir -p /var/run/ovn
+
+WORKDIR /opt/ovn4nfv-k8s-plugin/utilities/docker/
+COPY ./ ./
+RUN cp /opt/ovn4nfv-k8s-plugin/utilities/docker/ovn4nfv-k8s.sh /usr/local/bin/ovn4nfv-k8s
+RUN echo $PATH
+ENTRYPOINT ["ovn4nfv-k8s"]
similarity index 87%
rename from utilities/docker/debian/ovn4nfv-k8s.sh
rename to utilities/docker/ovn4nfv-k8s.sh
index ee60e2b..e0795b0 100755 (executable)
@@ -8,6 +8,15 @@ DB_SB_ADDR=${DB_SB_ADDR:-::}
 DB_SB_PORT=${DB_SB_PORT:-6642}
 cmd=${1:-""}
 
+ovn-ctl()
+{
+   if [[ -f /usr/bin/ovn-appctl ]] ; then
+        echo /usr/share/ovn/scripts/ovn-ctl;
+   else
+        echo /usr/share/openvswitch/scripts/ovn-ctl;
+   fi
+}
+
 if [[ -f /usr/bin/ovn-appctl ]] ; then
     # ovn-appctl is present. Use new ovn run dir path.
     OVN_RUNDIR=/var/run/ovn
@@ -23,13 +32,13 @@ else
 fi
 
 check_ovn_control_plane() {
-    /usr/share/ovn/scripts/ovn-ctl status_northd
-    /usr/share/ovn/scripts/ovn-ctl status_ovnnb
-    /usr/share/ovn/scripts/ovn-ctl status_ovnsb
+    $(ovn-ctl) status_northd
+    $(ovn-ctl) status_ovnnb
+    $(ovn-ctl) status_ovnsb
 }
 
 check_ovn_controller() {
-    /usr/share/ovn/scripts/ovn-ctl status_controller
+    $(ovn-ctl) status_controller
 }
 
 # wait for ovn-sb ready
@@ -53,7 +62,7 @@ start_ovs_vswitch() {
     wait_ovn_sb
     function quit {
        /usr/share/openvswitch/scripts/ovs-ctl stop
-       /usr/share/openvswitch/scripts/ovn-ctl stop_controller
+       $(ovn-ctl) stop_controller
        exit 0
     }
     trap quit EXIT
@@ -88,34 +97,34 @@ function get_default_inteface_ipaddress {
 
 start_ovn_control_plane() {
     function quit {
-        /usr/share/openvswitch/scripts/ovn-ctl stop_northd
+        $(ovn-ctl) stop_northd
          exit 0
     }
     trap quit EXIT
-    /usr/share/openvswitch/scripts/ovn-ctl restart_northd
+    $(ovn-ctl) restart_northd
     ovn-nbctl set-connection ptcp:"${DB_NB_PORT}":["${DB_NB_ADDR}"]
     ovn-nbctl set Connection . inactivity_probe=0
     ovn-sbctl set-connection ptcp:"${DB_SB_PORT}":["${DB_SB_ADDR}"]
     ovn-sbctl set Connection . inactivity_probe=0
-    tail -f /var/log/openvswitch/ovn-northd.log
+    tail -f ${OVN_LOGDIR}/ovn-northd.log
 }
 
 start_ovn_controller() {
     function quit {
-       /usr/share/openvswitch/scripts/ovn-ctl stop_controller
+       $(ovn-ctl) stop_controller
        exit 0
     }
     trap quit EXIT
     wait_ovn_sb
     get_default_inteface_ipaddress node_ipv4_address
-    /usr/share/openvswitch/scripts/ovn-ctl restart_controller
+    $(ovn-ctl) restart_controller
     # Set remote ovn-sb for ovn-controller to connect to
     ovs-vsctl set open . external-ids:ovn-remote=tcp:"${OVN_SB_TCP_SERVICE_HOST}":"${OVN_SB_TCP_SERVICE_PORT}"
     ovs-vsctl set open . external-ids:ovn-remote-probe-interval=10000
     ovs-vsctl set open . external-ids:ovn-openflow-probe-interval=180
     ovs-vsctl set open . external-ids:ovn-encap-type=geneve
     ovs-vsctl set open . external-ids:ovn-encap-ip=$node_ipv4_address
-    tail -f /var/log/openvswitch/ovn-controller.log
+    tail -f ${OVN_LOGDIR}/ovn-controller.log
 }
 
 set_nbclt() {