plugin

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

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

View Source
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

func CompletionArgs(argv []string) []string

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

func NewCommandCanI(out, errOut io.Writer) *cobra.Command

NewCommandCanI builds the `can-i` subcommand.

func NewCommandPrune

func NewCommandPrune(out, errOut io.Writer) *cobra.Command

NewCommandPrune builds the `prune` subcommand.

func NewCommandRBAC

func NewCommandRBAC(out, errOut io.Writer) *cobra.Command

NewCommandRBAC builds the `rbac` subcommand.

func NewCommandSchema added in v0.3.0

func NewCommandSchema(out, errOut io.Writer) *cobra.Command

NewCommandSchema builds the `schema` subcommand.

func NewCommandStatus added in v0.3.0

func NewCommandStatus(out, errOut io.Writer) *cobra.Command

NewCommandStatus builds the `status` subcommand.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL