diff --git a/DEVELOPING.md b/DEVELOPING.md index 7099ee84..4f1b1867 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -20,8 +20,6 @@ For example, run it after changing the `tcp_event` struct in `tcp_probe.c`. When building with `make docker-build`, the generated files are included in the build but not updated locally. -To run a locally-built image in Kubernetes on Docker Desktop, run `make mac-docker-build`. - ## To pull a published image from ghcr Docker images are found in [`ghcr.io/honeycombio/ebpf-agent:latest`](https://github.com/honeycombio/honeycomb-ebpf-agent/pkgs/container/ebpf-agent). diff --git a/Dockerfile.mac b/Dockerfile.mac deleted file mode 100644 index ee93a0c8..00000000 --- a/Dockerfile.mac +++ /dev/null @@ -1,12 +0,0 @@ -FROM golang:1.20 as builder -RUN apt update -yq && apt install -yq clang llvm make -WORKDIR /src -COPY go.* . -RUN go mod download -COPY . . -RUN make mac-build - -FROM ubuntu:22.04 -RUN apt-get update -yq && apt-get install -yq ca-certificates -COPY --from=builder /src/hny-ebpf-agent /bin/hny-ebpf-agent -CMD [ "/bin/hny-ebpf-agent" ] \ No newline at end of file diff --git a/Makefile b/Makefile index aec29bd7..eb465469 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,13 @@ REPODIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) # Build the list of header directories to compile the bpf program BPF_HEADERS += -I${REPODIR}/bpf/headers +# Disable BTF if the kernel doesn't support it (eg local dev on Docker Desktop) +# needed until BTF is enabled for Docker Desktop +# see https://github.com/docker/for-mac/issues/6800 +ifeq (,$(wildcard /sys/kernel/btf/vmlinux)) + BPF_HEADERS += -DBPF_NO_PRESERVE_ACCESS_INDEX +endif + IMG_NAME ?= hny/ebpf-agent IMG_TAG ?= local @@ -31,24 +38,6 @@ update-headers: cd bpf/headers && ./update.sh @echo "*** Also update bpf_tracing.h file! ***" -### Local Mac Build for Kubernetes on Docker Desktop - -# needed until BTF is enabled for Docker Desktop -# see https://github.com/docker/for-mac/issues/6800 - -.PHONY: mac-generate -mac-generate: export CFLAGS := $(BPF_HEADERS) -DBPF_NO_PRESERVE_ACCESS_INDEX -mac-generate: - go generate ./... - -.PHONY: mac-build -mac-build: mac-generate - CGO_ENABLED=0 GOOS=linux go build -o hny-ebpf-agent main.go - -.PHONY: mac-docker-build -mac-docker-build: - docker build --tag $(IMG_NAME):$(IMG_TAG) -f Dockerfile.mac . - ### Testing targets # deploy ebpf agent daemonset to already-running cluster with env vars from .env file diff --git a/bpf/probes/bpf_bpfel_arm64.go b/bpf/probes/bpf_bpfel_arm64.go index 46c1ba50..1be62da6 100644 --- a/bpf/probes/bpf_bpfel_arm64.go +++ b/bpf/probes/bpf_bpfel_arm64.go @@ -1,6 +1,5 @@ // Code generated by bpf2go; DO NOT EDIT. //go:build arm64 -// +build arm64 package probes diff --git a/bpf/probes/bpf_bpfel_x86.go b/bpf/probes/bpf_bpfel_x86.go index b8c7c871..6e2b2d1f 100644 --- a/bpf/probes/bpf_bpfel_x86.go +++ b/bpf/probes/bpf_bpfel_x86.go @@ -1,6 +1,5 @@ // Code generated by bpf2go; DO NOT EDIT. //go:build 386 || amd64 -// +build 386 amd64 package probes