Skip to content

Commit

Permalink
Merge pull request #91 from tiagonux/main
Browse files Browse the repository at this point in the history
Add support for deb packages
  • Loading branch information
numansiddique authored Nov 28, 2024
2 parents 9884f0a + fcbac9a commit be0bbb4
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 8 deletions.
2 changes: 1 addition & 1 deletion image/cinc/install_fedora_pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ systemctl mask \
systemd-udevd.service \
systemd-vconsole-setup.service

dnf -y --skip-broken install \
dnf install -y --skip-broken \
autoconf \
automake \
conntrack-tools \
Expand Down
1 change: 1 addition & 0 deletions image/cinc/install_ubuntu_pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ apt install -yq --no-install-recommends \
python3-pip \
python3-psutil \
python3-six \
python3-systemd \
resource-agents* \
tcpdump \
uuid
Expand Down
17 changes: 15 additions & 2 deletions image/ovn/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ MAINTAINER "Numan Siddique" <numans@ovn.org>
ARG OVS_SRC_PATH
ARG OVN_SRC_PATH
ARG USE_OVN_RPMS
ARG USE_OVN_DEBS
ARG EXTRA_OPTIMIZE
ARG INSTALL_UTILS_FROM_SOURCES
ARG USE_OVSDB_ETCD

COPY $OVS_SRC_PATH /ovs
COPY $OVN_SRC_PATH /ovn

COPY *.rpm /
COPY README.md *.rpm /
COPY README.md *.deb /
COPY install_ovn.sh /install_ovn.sh
COPY install_utils_from_sources.sh /install_utils_from_sources.sh
COPY install_ovsdb_etcd.sh /install_ovsdb_etcd.sh
Expand All @@ -20,11 +22,22 @@ COPY run_ovsdb_etcd.sh /run_ovsdb_etcd.sh
COPY run_ovsdb_etcd_sb.sh /run_ovsdb_etcd_sb.sh
COPY run_ovsdb_etcd_nb.sh /run_ovsdb_etcd_nb.sh

RUN /install_ovn.sh $USE_OVN_RPMS $EXTRA_OPTIMIZE
RUN /install_ovn.sh $USE_OVN_RPMS $USE_OVN_DEBS $EXTRA_OPTIMIZE
RUN /install_utils_from_sources.sh $INSTALL_UTILS_FROM_SOURCES
RUN /install_ovsdb_etcd.sh
RUN /install_etcd.sh

# Rely on the default way of starting each service from the ovn_cluster
# script. This is a workaround to avoid major changes on the ovn_cluster
# script and may be improved in the future.
RUN if [ "$USE_OVN_RPMS" = "yes" ] || [ "$USE_OVN_DEBS" = "yes" ] ; then \
/usr/bin/systemctl disable ovn-central && \
/usr/bin/systemctl disable ovn-ic-db && \
/usr/bin/systemctl disable ovn-ic && \
/usr/bin/systemctl disable openvswitch-switch && \
/usr/bin/systemctl disable ovn-host ; \
fi

VOLUME ["/var/log/openvswitch", \
"/var/lib/openvswitch", "/var/run/openvswitch", "/etc/openvswitch", \
"/var/log/ovn", "/var/lib/ovn", "/var/run/ovn", "/etc/ovn"]
9 changes: 7 additions & 2 deletions install_ovn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ set -o xtrace
set -o errexit

use_ovn_rpm=$1
extra_optimize=$2
use_ovn_debs=$2
extra_optimize=$3

# When system's python environment is marked as "Externally managed"
# (PEP 668), this variable is needed to allow pip to install
Expand All @@ -32,6 +33,10 @@ fi
if [ "$use_ovn_rpm" = "yes" ]; then
ls ovn*.rpm > /dev/null || exit 1
dnf install -y /*.rpm
elif [ "$use_ovn_debs" = "yes" ]; then
ls ovn*.deb > /dev/null || exit 1
apt update
apt install -y /*.deb
else
mkdir -p /root/ovsdb-etcd/schemas

Expand Down Expand Up @@ -90,7 +95,7 @@ popd
dnf autoremove -y || apt autoremove -y

# Clean all object files
if [ "$use_ovn_rpm" = "no" ]; then
if [ "$use_ovn_rpm" = "no" ] && [ "$use_ovn_debs" = "no" ]; then
cd /ovs
make distclean
cd /ovn
Expand Down
29 changes: 26 additions & 3 deletions ovn_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ GW_IMAGE=${GW_IMAGE:-"ovn/ovn-multi-node:latest"}
RELAY_IMAGE=${RELAY_IMAGE:-"ovn/ovn-multi-node:latest"}

USE_OVN_RPMS="${USE_OVN_RPMS:-no}"
USE_OVN_DEBS="${USE_OVN_DEBS:-no}"
EXTRA_OPTIMIZE="${EXTRA_OPTIMIZE:-no}"
OS_BASE=${OS_BASE:-"fedora"}
OS_IMAGE=${OS_IMAGE:-"quay.io/fedora/fedora:latest"}
Expand Down Expand Up @@ -964,6 +965,7 @@ function build-images() {

${RUNC_CMD} build -t ovn/ovn-multi-node --build-arg OVS_SRC_PATH=ovs \
--build-arg OVN_SRC_PATH=ovn --build-arg USE_OVN_RPMS=${USE_OVN_RPMS} \
--build-arg USE_OVN_DEBS=${USE_OVN_DEBS} \
--build-arg EXTRA_OPTIMIZE=${EXTRA_OPTIMIZE} \
--build-arg INSTALL_UTILS_FROM_SOURCES=${INSTALL_UTILS_FROM_SOURCES} \
--build-arg USE_OVSDB_ETCD=${USE_OVSDB_ETCD} \
Expand All @@ -975,13 +977,25 @@ function check-for-ovn-rpms() {
ls ovn*.rpm > /dev/null 2>&1 || USE_OVN_RPMS=no
}

function check-for-ovn-debs() {
USE_OVN_DEBS=yes
ls ovn*.deb > /dev/null 2>&1 || USE_OVN_DEBS=no
}

function build-images-with-ovn-rpms() {
mkdir -p ovs
mkdir -p ovn
rm -f tst.rpm
build-images
}

function build-images-with-ovn-debs() {
mkdir -p ovs
mkdir -p ovn
rm -f tst.deb
build-images
}

function build-images-with-ovn-sources() {
if [ ! -d ./ovs ]; then
echo "OVS_SRC_PATH = $OVS_SRC_PATH"
Expand All @@ -1007,8 +1021,10 @@ function build-images-with-ovn-sources() {
fi

touch tst.rpm
touch tst.deb
build-images
rm -f tst.rpm
rm -f tst.deb
[ -n "$DO_RM_OVS" ] && rm -rf ovs ||:
[ -n "$DO_RM_OVN" ] && rm -rf ovn ||:
}
Expand Down Expand Up @@ -1114,10 +1130,17 @@ case "${1:-""}" in
;;
build)
check-for-ovn-rpms
if [ "$USE_OVN_RPMS" == "yes" ]
then
echo "Building images using OVN rpms"
check-for-ovn-debs
if [ "$USE_OVN_RPMS" == "yes" ] && [ "$USE_OVN_DEBS" == "yes" ] ; then
echo "Do not keep rpm and deb packages on the same directory or enable both package manager!"
exit 1
fi
if [ "$USE_OVN_RPMS" == "yes" ] ; then
echo "Building images using OVN rpms"
build-images-with-ovn-rpms
elif [ "$USE_OVN_DEBS" == "yes" ] ; then
echo "Building images using OVN debs"
build-images-with-ovn-debs
else
echo "Building images using OVN/OVS sources"
build-images-with-ovn-sources
Expand Down

0 comments on commit be0bbb4

Please sign in to comment.