Skip to content

Commit

Permalink
fix(ebpf): include ebpf programs in artifacts (#5262)
Browse files Browse the repository at this point in the history
Signed-off-by: Bart Smykla <[email protected]>

Signed-off-by: Bart Smykla <[email protected]>
  • Loading branch information
bartsmykla authored Nov 4, 2022
1 parent c196b78 commit 4e12bd1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
21 changes: 21 additions & 0 deletions tools/releases/distros.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down
7 changes: 4 additions & 3 deletions tools/releases/dockerfiles/Dockerfile.kuma-init
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down

0 comments on commit 4e12bd1

Please sign in to comment.