Developing eBPF
does not require a Linux machine, however running the probes does. eBPF
itself is a Linux kernel technology, therefore any actual BPF
programs must run in the Linux kernel. We are working on an OSX development path, but it has not been completed as of yet.
We recommend doing eBPF
development on a Linux machine. Do not fret however if you don't have a native Linux desktop, neither do we. Using vscode
and GCP allows for a seamless near native development experience. See the following article for more detail. The article details the steps on a Windows machine, but they should be nearly identical on a macOS.
Also worth noting , bee
does not currently support ARM architectures (coming soon). However, the above development trick should alleviate that issue in the short-term.
The following is a brief overview of the internal code structure
├── builder ## Dockerfile and scripts related to our eBPF build container
├── ci ## Scripts and helpers for CI
├── docs ## Docs and other useful information for interacting with bumblebee
├── bee ## main.go file for bee, majority of code is in pkg
├── examples ## Variety of example eBPF programs to be run with bee
├── pkg ## Primary code directory
└── spec ## Contains information related to eBPF OCI Spec
For non-Linux users, we have a Vagrant box available for you to easily get started with a Linux environment.
After checking out the source code of the bumblebee repo, you can simply start the Vagrant VM and SSH into the VM:
cd bumblebee
vagrant up
vagrant ssh
This bumblebee folder will be mounted under "/source" in the vagrant VM. This VM has BTF already enabled, along with all other required tool chains such as Docker, Go, LLVM, etc. Refer to its Vagrantfile for more details.
For fast iterations of go code / bpf programs, you can build with our build script, and run with go run as follows:
cd /source
./builder/build.sh ./examples/tcpconnect/tcpconnect.c tcpconnect.o
go run -exec sudo ./bee/main.go run tcpconnect.o
To make a local docker image for the bee
to use, you can run:
make docker-build
Or, if for podman:
make docker-build DOCKER=podman
You can then use the docker image in the bee build
command, for example:
bee build examples/tcpconnect/tcpconnect.c tcpconnect.o -i $DOCKER_BUILT_IMAGE
TAGGED_VERSION=vdev make docker-build-bee
go run ./bee/main.go build -i ghcr.io/solo-io/bumblebee/builder:0.0.9 examples/tcpconnect/tcpconnect.c tcpconnect
go run ./bee/main.go package tcpconnect bee-tcpconnect:v1
docker run --privileged bee-tcpconnect:v1