Inspiration

I love the Cilium project but I also love the Aya Project, the Rust framework to create eBPF programs. My heart is torn, I cannot choose ! So I thought, why not bring them together.

That’s how Goya was born: A playful crossover between Go and Aya. (And no, it’s not named after my favorite painter!)

What it does

Goya is a little framework that uses Aya for the kernel space (Rust) and Cilium for the user space (Go). The best of both worlds? I’ll let you be the judge!

How I built it

  • I forked aya-template and removed the Rust user space part.
  • I wrote the golang user space code using Cilium library and templated for different types of eBPF program.
  • For now, it only supports:
    • XDP programs
    • classifier programs
    • kprobe and kretprobe programs
    • uprobe and uretprobe programs
    • tracepoint programs
    • btf tracepoint programs
    • LSM programs
  • I updated the CI to test the build and the installation of the different types of eBPF program in the kernel.
  • I also created a Taskfile to build and install eBPF programs and a docker image (littlejo/aya:goya) to test the framework.

Challenges I ran into

  • retrieving the eBPF program generated by Aya and installation with Cilium
  • managing the eBPF ring buffer map for aya log with Cilium go library.

Accomplishments that i'm proud of

  • It's as easy as the Aya project to generate and install an eBPF program:
cargo generate https://github.com/goya-rs/goya-template
cd dir
task

goya demo

And just like that you have the "hello world" eBPF program.

  • Creating a project that combines modern languages like Rust and Go.
  • If your control plane is written in Go and you prefer Rust over C for eBPF development, Goya is a great option!

What I learned

  • how to retrieve an eBPF binary created by Aya
  • how to use Cilium library in user space
  • how Aya logs work under the hood

What's next for Goya

  • Add more types of eBPF program
  • Improve aya log parsing
  • Improve CI to trigger every eBPF program
  • Add examples of eBPF map management between user space and kernel space.
  • Better code factorization and organization.
  • Handle updates of the Aya and Cilium library.
  • Maybe an integration of Goya in the Aya project?

Built With

Share this project:

Updates