Skip to content

BuoyantIO/linkerd-golang-extension

Repository files navigation

linkerd-golang-extension

The Linkerd service mesh includes a simple but powerful extension mechanism:

  • Anyone can write an extension to the Linkerd CLI simply by including an executable named linkerd-$extension in their PATH; this will be usable as linkerd $extension. (This is basically the same mechanism as extensions for kubectl.)

  • Anyone can also write a Kubernetes controller that interacts with the Linkerd CRDs for whatever purpose they want. Obviously, this is most useful when coupled with a CLI extension.

Buoyant is providing this repository (https://github.com/BuoyantIO/linkerd-golang-extension) as a tutorial example of how to write a Linkerd extension in Golang.

Building

You must have Go version 1.19 or higher installed.

  • To build, just run make.

    • If needed, you can set GOARCH and GOOS as needed (e.g. make GOOS=linux GOARCH=amd64 to cross-compile for an x86 Kubernetes environment on a Mac).
  • To clean everything up, use make clean.

The CLI Extension

More details about writing a CLI extension are available in EXTENSIONS.md in the main Linkerd2 repo. It details the required commands (install, uninstall, and check) switches. Note that extensions are allowed to implement additional commands, but the three commands above are required.

The sources for the CLI part of this extension are in the cmd directory. Start reading with cmd/main.go.

Flow diagram

signal_flow

About

A sample Linkerd extension, written in Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published