Currently the ovn repository maintains it's own Dockerfile to build ovn-kubernetes images using upstream ovn code and that is unnecessary. The Dockerfile provided by ovn-kube has the parameters required to build ovn-kube images containing ovn test code.
Reported-by: Dumitru Ceara <[email protected]> Requested-by: Dumitru Ceara <[email protected]> Reported-at: https://issues.redhat.com/browse/FDP-852 Signed-off-by: Jacob Tanenbaum <[email protected]> diff --git a/.ci/ovn-kubernetes/Dockerfile b/.ci/ovn-kubernetes/Dockerfile deleted file mode 100644 index 4a7a41c79..000000000 --- a/.ci/ovn-kubernetes/Dockerfile +++ /dev/null @@ -1,109 +0,0 @@ -ARG OVNKUBE_COMMIT -ARG GO_VERSION -ARG FEDORA_VERSION - -FROM fedora:$FEDORA_VERSION AS ovnbuilder - -USER root - -ENV PYTHONDONTWRITEBYTECODE yes - -# install needed rpms - openvswitch must be 2.10.4 or higher -RUN INSTALL_PKGS=" rpm-build dnf-plugins-core" && \ - dnf install --best --refresh -y --setopt=tsflags=nodocs $INSTALL_PKGS - -# Build OVS and OVN rpms from current folder -RUN mkdir /tmp/ovn -COPY . /tmp/ovn -WORKDIR /tmp/ovn/ovs - -RUN sed -e 's/@VERSION@/0.0.1/' rhel/openvswitch-fedora.spec.in > /tmp/ovs.spec -RUN dnf builddep -y /tmp/ovs.spec -RUN ./boot.sh -RUN ./configure -v -RUN make rpm-fedora -RUN rm rpm/rpmbuild/RPMS/x86_64/*debug* -RUN rm rpm/rpmbuild/RPMS/x86_64/*devel* - -WORKDIR /tmp/ovn -RUN sed -e 's/@VERSION@/0.0.1/' rhel/ovn-fedora.spec.in > /tmp/ovn.spec -RUN dnf builddep -y /tmp/ovn.spec -RUN ./boot.sh -RUN ./configure -RUN make rpm-fedora -RUN rm rpm/rpmbuild/RPMS/x86_64/*debug* -RUN rm rpm/rpmbuild/RPMS/x86_64/*docker* - -# Build ovn-kubernetes -ARG GO_VERSION -FROM golang:$GO_VERSION as ovnkubebuilder -ARG OVNKUBE_COMMIT -ARG FEDORA_VERSION - -# Clone OVN Kubernetes and build the binary based on the commit passed as argument -WORKDIR /root -RUN git clone https://github.com/ovn-kubernetes/ovn-kubernetes.git -WORKDIR /root/ovn-kubernetes -RUN git checkout ${OVNKUBE_COMMIT} && git log -n 1 - -# Copy the ovn-kubernetes scripts from the OVN sources and apply any -# custom changes if needed. -RUN mkdir -p /tmp/ovn/.ci/ovn-kubernetes -COPY .ci/ovn-kubernetes /tmp/ovn/.ci/ovn-kubernetes -WORKDIR /tmp/ovn -RUN .ci/ovn-kubernetes/prepare.sh /root/ovn-kubernetes /dev/null - -WORKDIR /root/ovn-kubernetes/go-controller -# Get a working version of libovsdb (for modelgen). -RUN GO111MODULE=on go install \ - github.com/ovn-kubernetes/libovsdb/cmd/modelgen@$( \ - go list -mod=mod -m -f '{{ .Version }}' \ - github.com/ovn-kubernetes/libovsdb \ -) - -# Make sure we use the OVN NB/SB schema from the local code. -COPY --from=ovnbuilder /tmp/ovn/ovn-nb.ovsschema pkg/nbdb/ovn-nb.ovsschema -COPY --from=ovnbuilder /tmp/ovn/ovn-sb.ovsschema pkg/sbdb/ovn-sb.ovsschema -RUN go generate ./pkg/nbdb && go generate ./pkg/sbdb && make - -# Build the final image -FROM fedora:$FEDORA_VERSION - -# install needed dependencies -RUN INSTALL_PKGS=" \ - iptables nftables iproute iputils hostname unbound-libs \ - kubernetes-client kmod socat" && \ - dnf install --best --refresh -y --setopt=tsflags=nodocs $INSTALL_PKGS - -RUN mkdir -p /var/run/openvswitch - -# install openvswitch and ovn rpms built in previous stages -COPY --from=ovnbuilder /tmp/ovn/rpm/rpmbuild/RPMS/x86_64/*rpm ./ -COPY --from=ovnbuilder /tmp/ovn/ovs/rpm/rpmbuild/RPMS/x86_64/*rpm ./ -COPY --from=ovnbuilder /tmp/ovn/ovs/rpm/rpmbuild/RPMS/noarch/*rpm ./ -RUN dnf install -y *.rpm && rm -f *.rpm - -# install ovn-kubernetes binaries built in previous stage -RUN mkdir -p /usr/libexec/cni/ -COPY --from=ovnkubebuilder /root/ovn-kubernetes/go-controller/_output/go/bin/ovnkube /usr/bin/ -COPY --from=ovnkubebuilder /root/ovn-kubernetes/go-controller/_output/go/bin/ovnkube-identity /usr/bin/ -COPY --from=ovnkubebuilder /root/ovn-kubernetes/go-controller/_output/go/bin/ovn-kube-util /usr/bin/ -COPY --from=ovnkubebuilder /root/ovn-kubernetes/go-controller/_output/go/bin/ovndbchecker /usr/bin/ -COPY --from=ovnkubebuilder /root/ovn-kubernetes/go-controller/_output/go/bin/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 --from=ovnkubebuilder /root/ovn-kubernetes/dist/images/ovnkube.sh /root/ -COPY --from=ovnkubebuilder /root/ovn-kubernetes/dist/images/ovndb-raft-functions.sh /root/ -COPY --from=ovnkubebuilder /root/ovn-kubernetes/dist/images/iptables-scripts /usr/sbin/ - -# Make some room. -RUN REMOVE_PKGS="llvm-libs clang-libs" && \ - dnf remove -y $REMOVE_PKGS && dnf clean all && rm -rf /var/cache/dnf/* - -LABEL io.k8s.display-name="ovn-kubernetes" \ - io.k8s.description="This is a Kubernetes network plugin that provides an overlay network using OVN." \ - maintainer="ovn team" - -WORKDIR /root -ENTRYPOINT /root/ovnkube.sh diff --git a/.github/workflows/ovn-kubernetes.yml b/.github/workflows/ovn-kubernetes.yml index 05f1ba5b8..6449fed5c 100644 --- a/.github/workflows/ovn-kubernetes.yml +++ b/.github/workflows/ovn-kubernetes.yml @@ -55,10 +55,10 @@ jobs: - name: Build ovn-kubernetes container run: | - docker build --build-arg OVNKUBE_COMMIT=${{ env.OVNKUBE_COMMIT }} \ - --build-arg GO_VERSION=${{ env.GO_VERSION }} \ - --build-arg FEDORA_VERSION=42 \ - --squash -t ovn-daemonset-f:dev -f .ci/ovn-kubernetes/Dockerfile . + make -C src/github.com/ovn-kubernetes/ovn-kubernetes/dist/images \ + IMAGE=ovn-daemonset-f:dev \ + OVN_REPO=https://github.com/${{ github.repository }}.git \ + OVN_GITREF=${{ github.ref_name }} fedora-image mkdir /tmp/_output docker save ovn-daemonset-f:dev > /tmp/_output/image.tar diff --git a/Makefile.am b/Makefile.am index 3ad2077b3..78aa587e2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -91,7 +91,6 @@ EXTRA_DIST = \ .ci/linux-util.sh \ .ci/osx-build.sh \ .ci/osx-prepare.sh \ - .ci/ovn-kubernetes/Dockerfile \ .ci/ovn-kubernetes/prepare.sh \ .ci/ovn-kubernetes/custom.patch \ .github/workflows/containers.yml \ -- 2.52.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
