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 theirPATH
; this will be usable aslinkerd $extension
. (This is basically the same mechanism as extensions forkubectl
.) -
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.
You must have Go version 1.19 or higher installed.
-
To build, just run
make
.- If needed, you can set
GOARCH
andGOOS
as needed (e.g.make GOOS=linux GOARCH=amd64
to cross-compile for an x86 Kubernetes environment on a Mac).
- If needed, you can set
-
To clean everything up, use
make clean
.
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
.