Documentation
¶
Overview ¶
Package plugin holds the commands of kubectl-crisp, the kubectl plugin.
Separate from the server binary on purpose. `kube-crisp-apiserver validate` has to ship with the server because its answer is build-specific — it consults the driver registry, so a projection naming a driver this build did not link in is rejected here and accepted by a build that did. Nothing in this package depends on the registry, on a database, or on cgo, and the person who needs it is granting a colleague access to a projected kind. They have kubectl. They do not have the API server binary.
Index ¶
- Constants
- func CompletionArgs(argv []string) []string
- func NewCommandCanI(out, errOut io.Writer) *cobra.Command
- func NewCommandPrune(out, errOut io.Writer) *cobra.Command
- func NewCommandRBAC(out, errOut io.Writer) *cobra.Command
- func NewCommandSchema(out, errOut io.Writer) *cobra.Command
- func NewCommandStatus(out, errOut io.Writer) *cobra.Command
Constants ¶
const CompletionName = "kubectl_complete-crisp"
CompletionName is the name kubectl runs to complete `kubectl crisp`.
kubectl reaches a plugin's completion through one hook and no other. Its pluginCompletion derives this name from the plugin's own — the first `-` becomes `_complete-` — looks it up with exec.LookPath, runs what it finds with the words typed so far, and reads the output as cobra's __complete protocol. A plugin that could answer perfectly is never asked if no file carries the name, which is why `kubectl crisp <TAB>` used to offer nothing while `kubectl-crisp __complete ""` answered.
Nothing says the file has to be a separate program. A wrapper script would be a second thing to build, ship, sign and keep in step with this one, so the plugin answers to the name itself and the two cannot drift:
ln -s kubectl-crisp kubectl_complete-crisp
Variables ¶
This section is empty.
Functions ¶
func CompletionArgs ¶ added in v0.3.0
CompletionArgs turns a process's argv into the arguments to run.
Under CompletionName the arguments are the ones kubectl wants completed, so they become the hidden __complete call cobra already gives every command. Under any other name — kubectl-crisp, or `kubectl crisp`, which execs the same file — they are the user's own and are passed through untouched.
The .exe comes off for windows, where kubectl's lookup goes through PATHEXT and so only finds the name with an executable extension on it.
func NewCommandCanI ¶
NewCommandCanI builds the `can-i` subcommand.
func NewCommandPrune ¶
NewCommandPrune builds the `prune` subcommand.
func NewCommandRBAC ¶
NewCommandRBAC builds the `rbac` subcommand.
func NewCommandSchema ¶ added in v0.3.0
NewCommandSchema builds the `schema` subcommand.
Types ¶
This section is empty.