Skip to content

Commit

Permalink
Add GoBGP client binary to antrea agent image
Browse files Browse the repository at this point in the history
Signed-off-by: Rajnish Kumar <[email protected]>
  • Loading branch information
rajnkamr committed Aug 6, 2024
1 parent 29f947c commit d73f352
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ANTCTL_BINARY_NAME ?= antctl
OVS_VERSION := $(shell head -n 1 build/images/deps/ovs-version)
GO_VERSION := $(shell head -n 1 build/images/deps/go-version)
CNI_BINARIES_VERSION := $(shell head -n 1 build/images/deps/cni-binaries-version)
BGP_VERSION := $(shell head -n 1 build/images/deps/bgp-version)
GIT_HOOKS := $(shell find hack/git_client_side_hooks -type f -print)
DOCKER_NETWORK ?= default
TRIVY_TARGET_IMAGE ?=
Expand Down
7 changes: 5 additions & 2 deletions build/images/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ ARG BUILD_TAG
FROM ubuntu:22.04 AS cni-binaries

ARG CNI_BINARIES_VERSION
ARG BGP_VERSION

RUN apt-get update && \
apt-get install -y --no-install-recommends wget ca-certificates

# Leading dot is required for the tar command below
ENV CNI_PLUGINS="./host-local ./loopback ./portmap ./bandwidth"

# Download containernetworking plugin binaries for the correct architecture
RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
Expand All @@ -33,7 +33,10 @@ RUN set -eux; \
*) pluginsArch=''; echo >&2; echo >&2 "unsupported architecture '$dpkgArch'"; echo >&2 ; exit 1 ;; \
esac; \
mkdir -p /opt/cni/bin; \
wget -q -O - https://github.com/containernetworking/plugins/releases/download/$CNI_BINARIES_VERSION/cni-plugins-linux-${pluginsArch}-$CNI_BINARIES_VERSION.tgz | tar xz -C /opt/cni/bin $CNI_PLUGINS
wget -q -O - https://github.com/containernetworking/plugins/releases/download/$CNI_BINARIES_VERSION/cni-plugins-linux-${pluginsArch}-$CNI_BINARIES_VERSION.tgz | tar xz -C /opt/cni/bin $CNI_PLUGINS; \
mkdir -p /opt/cni/bin/bgp; \
wget -q -O - https://github.com/osrg/gobgp/releases/download/v$BGP_VERSION/gobgp_${BGP_VERSION}_linux_${pluginsArch}.tar.gz | tar xz -C /opt/cni/bin/bgp; \
find /opt/cni/bin/bgp -type f ! -name 'gobgp' -delete

FROM antrea/openvswitch:${BUILD_TAG}

Expand Down
6 changes: 5 additions & 1 deletion build/images/base/Dockerfile.ubi
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ARG BUILD_TAG
FROM ubuntu:22.04 AS cni-binaries

ARG CNI_BINARIES_VERSION
ARG BGP_VERSION

RUN apt-get update && \
apt-get install -y --no-install-recommends wget ca-certificates
Expand All @@ -33,7 +34,10 @@ RUN set -eux; \
*) pluginsArch=''; echo >&2; echo >&2 "unsupported architecture '$dpkgArch'"; echo >&2 ; exit 1 ;; \
esac; \
mkdir -p /opt/cni/bin; \
wget -q -O - https://github.com/containernetworking/plugins/releases/download/$CNI_BINARIES_VERSION/cni-plugins-linux-${pluginsArch}-$CNI_BINARIES_VERSION.tgz | tar xz -C /opt/cni/bin $CNI_PLUGINS
wget -q -O - https://github.com/containernetworking/plugins/releases/download/$CNI_BINARIES_VERSION/cni-plugins-linux-${pluginsArch}-$CNI_BINARIES_VERSION.tgz | tar xz -C /opt/cni/bin $CNI_PLUGINS; \
mkdir -p /opt/cni/bin/bgp; \
wget -q -O - https://github.com/osrg/gobgp/releases/download/v$BGP_VERSION/gobgp_${BGP_VERSION}_linux_${pluginsArch}.tar.gz | tar xz -C /opt/cni/bin/bgp; \
find /opt/cni/bin/bgp -type f ! -name 'gobgp' -delete

FROM antrea/openvswitch-ubi:${BUILD_TAG}

Expand Down
4 changes: 2 additions & 2 deletions build/images/base/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ fi
pushd $THIS_DIR > /dev/null

CNI_BINARIES_VERSION=$(head -n 1 ../deps/cni-binaries-version)
BGP_VERSION=$(head -n 1 ../deps/bgp-version)
SURICATA_VERSION=$(head -n 1 ../deps/suricata-version)

BUILD_CACHE_TAG=$(../build-tag.sh)
Expand Down Expand Up @@ -152,8 +153,7 @@ fi
function docker_build_and_push() {
local image="$1"
local dockerfile="$2"
local build_args="--build-arg CNI_BINARIES_VERSION=$CNI_BINARIES_VERSION --build-arg SURICATA_VERSION=$SURICATA_VERSION --build-arg BUILD_TAG=$BUILD_TAG"
local cache_args=""
local build_args="--build-arg CNI_BINARIES_VERSION=$CNI_BINARIES_VERSION --build-arg BGP_VERSION=$BGP_VERSION --build-arg SURICATA_VERSION=$SURICATA_VERSION --build-arg BUILD_TAG=$BUILD_TAG"
if $PUSH; then
cache_args="$cache_args --cache-to type=registry,ref=$image-cache:$BUILD_CACHE_TAG,mode=max"
fi
Expand Down
1 change: 1 addition & 0 deletions build/images/deps/bgp-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.28.0
1 change: 1 addition & 0 deletions hack/build-antrea-linux-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ fi

CNI_BINARIES_VERSION=$(head -n 1 build/images/deps/cni-binaries-version)
GO_VERSION=$(head -n 1 build/images/deps/go-version)
BGP_VERSION=$(head -n 1 build/images/deps/bgp-version)

if [ "$BUILD_TAG" != "" ]; then
ARGS="$ARGS --build-tag $BUILD_TAG"
Expand Down

0 comments on commit d73f352

Please sign in to comment.