From 4e12bd1ab225d20005da81049932a7ed4056028a Mon Sep 17 00:00:00 2001 From: Bart Smykla Date: Fri, 4 Nov 2022 16:07:20 +0100 Subject: [PATCH] fix(ebpf): include ebpf programs in artifacts (#5262) Signed-off-by: Bart Smykla Signed-off-by: Bart Smykla --- go.mod | 2 +- go.sum | 4 ++-- tools/releases/distros.sh | 21 +++++++++++++++++++ .../releases/dockerfiles/Dockerfile.kuma-init | 7 ++++--- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 3bc200ed9253..eb9dd2abbd23 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/gruntwork-io/terratest v0.40.24 github.com/hoisie/mustache v0.0.0-20160804235033-6375acf62c69 github.com/kelseyhightower/envconfig v1.4.0 - github.com/kumahq/kuma-net v0.8.5 + github.com/kumahq/kuma-net v0.8.6 github.com/kumahq/protoc-gen-kumadoc v0.3.1 github.com/lib/pq v1.10.7 github.com/miekg/dns v1.1.50 diff --git a/go.sum b/go.sum index a53ab91c7166..22f5a0716161 100644 --- a/go.sum +++ b/go.sum @@ -1018,8 +1018,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4= github.com/kumahq/gateway-api v0.0.0-20221019125100-747a4fedfd7a h1:szFGMVdySxtKAjCxO3JUncfr1JGWOIlQaqWnrTUJsBc= github.com/kumahq/gateway-api v0.0.0-20221019125100-747a4fedfd7a/go.mod h1:x0AP6gugkFV8fC/oTlnOMU0pnmuzIR8LfIPRVUjxSqA= -github.com/kumahq/kuma-net v0.8.5 h1:ig3u6JSfOp4l/ntU2en3RC1kqOWfjpkv80MqYLuYrMo= -github.com/kumahq/kuma-net v0.8.5/go.mod h1:aqhBHsY3LQCTvBOr7oU1r2hwjTn9vhXUKDJXJokkSCM= +github.com/kumahq/kuma-net v0.8.6 h1:/luArNTn/3LfQxK00D0FpAP3Shf5BkbXCqCfsGQcJ9s= +github.com/kumahq/kuma-net v0.8.6/go.mod h1:aqhBHsY3LQCTvBOr7oU1r2hwjTn9vhXUKDJXJokkSCM= github.com/kumahq/protoc-gen-kumadoc v0.3.1 h1:tY2dGQJTYVGkhxAHN154fddcWDRy55Pl4+oLT+FhsHo= github.com/kumahq/protoc-gen-kumadoc v0.3.1/go.mod h1:F+c9RjgKlv1Q3UEoPJCtMJw8Fd+X5PfG5jlkTSfZOMA= github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= diff --git a/tools/releases/distros.sh b/tools/releases/distros.sh index 5a5f3e32952d..ef893cf9e06d 100755 --- a/tools/releases/distros.sh +++ b/tools/releases/distros.sh @@ -28,6 +28,7 @@ PULP_DIST_NAME="alpine" ENVOY_VERSION=$("${SCRIPT_DIR}/../envoy/version.sh") [ -z "$KUMA_CONFIG_PATH" ] && KUMA_CONFIG_PATH=pkg/config/app/kuma-cp/kuma-cp.defaults.yaml CTL_NAME="kumactl" +[ -z "$EBPF_PROGRAMS_IMAGE" ] && EBPF_PROGRAMS_IMAGE="kumahq/kuma-net-ebpf:0.8.6" function get_envoy() { local distro=$1 @@ -42,6 +43,25 @@ function get_envoy() { if [ "$status" -ne "200" ]; then msg_err "Error: failed downloading Envoy"; fi } +function get_ebpf_programs() { + local arch=$1 + local system=$2 + local kuma_dir=$3 + local container + + if [[ "$system" != "linux" ]]; then + return + fi + + if [[ "$arch" != "amd64" ]] && [[ "$arch" != "arm64" ]]; then + return + fi + + container=$(DOCKER_DEFAULT_PLATFORM=$system/$arch docker create "$EBPF_PROGRAMS_IMAGE" copy) + docker cp "$container:/ebpf" "$kuma_dir" + docker rm -v "$container" +} + # create_kumactl_tarball packages only kumactl function create_kumactl_tarball() { local arch=$1 @@ -94,6 +114,7 @@ function create_tarball() { mkdir "$kuma_dir/conf" get_envoy "$distro" "$envoy_distro" "$arch" + get_ebpf_programs "$arch" "$system" "$kuma_dir" chmod 755 build/envoy-"$distro" artifact_dir=$(artifact_dir "$arch" "$system") diff --git a/tools/releases/dockerfiles/Dockerfile.kuma-init b/tools/releases/dockerfiles/Dockerfile.kuma-init index 39eb4a1ff966..97835495a14a 100644 --- a/tools/releases/dockerfiles/Dockerfile.kuma-init +++ b/tools/releases/dockerfiles/Dockerfile.kuma-init @@ -1,5 +1,6 @@ ARG BASE_IMAGE_ARCH=amd64 -ARG EBPF_IMAGE=kumahq/kuma-net-ebpf:0.8.5 +# When updatinng image version, remember to update it in tools/releases/distros.sh as well +ARG EBPF_IMAGE=kumahq/kuma-net-ebpf:0.8.6 FROM --platform=linux/$BASE_IMAGE_ARCH $EBPF_IMAGE as ebpf FROM --platform=linux/$BASE_IMAGE_ARCH ubuntu:jammy @@ -17,9 +18,9 @@ COPY /tools/releases/templates/LICENSE \ /kuma/ COPY /tools/releases/templates/NOTICE-kumactl /kuma/NOTICE -# ebpf -COPY --from=ebpf /mb_* /kuma/ebpf/ +# ebpf +COPY --from=ebpf /ebpf /kuma/ebpf RUN update-alternatives --set iptables /usr/sbin/iptables-legacy