This guide demonstrates how to install and write extensions for pulsarctl.
You need to have a working pulsarctl
binary installed. And the version of the pulsarctl need to be 0.4.0+.
A plugin is nothing more than a standalone executable file, whose name begins with pulsarctl-
. To install
a plugin, simply move its executable file to anywhere on your PATH
.
You can write a plugin in any programming language or script that allows you to write command-line commands.
There is no plugin installation or pre-loading required. Plugin executables receive the inherited environment from the plsarctl binary. A plugin determines which command path it wishes to implement based on its name. For example, a plugin wanting to provide a new command pulsarctl foo, would simply be named pulsarctl-foo, and live somewhere in your PATH.
#!/bin/bash
if [[ $1 == "args" ]]
then
echo "I am the args of the pulsarctl-foo"
exit 0
fi
echo "I am a plugin named pulsarctl-foo"
To use the above plugin, simply make it executable:
chmod +x ./pulsarctl-foo
and place it anywhere in your PATH
:
mv pulsarctl-foo /usr/local/bin
You may now invoke your plugin as a kubectl command:
pulsarctl foo
I am a plugin named pulsarctl-foo
All args and flags are passed as-is to the executable:
pulsarctl foo args
I am the args of the pulsarctl-foo