Documentation ¶
Overview ¶
Package plugin helps apply kubectl plugin-specific cli configuration. See https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/#accessing-runtime-attributes.
Index ¶
Constants ¶
View Source
const ( // Name of the plugin binary Name = "svcat" // EnvPluginCaller contains the path to the parent caller // Example: /usr/bin/kubectl. EnvPluginCaller = "KUBECTL_PLUGINS_CALLER" // EnvPluginLocalFlagPrefix contains the prefix applied to any command flags // Example: KUBECTL_PLUGINS_LOCAL_FLAG_FOO EnvPluginLocalFlagPrefix = "KUBECTL_PLUGINS_LOCAL_FLAG" // EnvPluginNamespace is the final namespace, after taking into account all the // kubectl flags and environment variables. EnvPluginNamespace = "KUBECTL_PLUGINS_CURRENT_NAMESPACE" // EnvPluginGlobalFlagPrefix contains the prefix applied to any global kubectl flags EnvPluginGlobalFlagPrefix = "KUBECTL_PLUGINS_GLOBAL_FLAG" // EnvPluginVerbose is the -v=LEVEL flag EnvPluginVerbose = EnvPluginGlobalFlagPrefix + "_V" // EnvPluginPath overrides where plugins should be installed. EnvPluginPath = "KUBECTL_PLUGINS_PATH" )
Variables ¶
This section is empty.
Functions ¶
func BindEnvironmentVariables ¶
BindEnvironmentVariables connects the viper configuration back to a cobra command's flags. Allows us to interact with the cobra flags normally, and while still using viper's automatic environment variable binding.
Types ¶
type Flag ¶
type Flag struct { // Name of the flag. Required. Name string `json:"name"` // Shorthand flag, must be a single character. Shorthand string `json:"shorthand,omitempty"` // Desc of the flag for the help text. Required. Desc string `json:"desc"` // DefValue is the default value to use when the flag is not specified. DefValue string `json:"defValue,omitempty"` }
Flag describes a flag exposed by a plugin command.
type Manifest ¶
type Manifest struct {
Plugin `json:",inline"`
}
Manifest is the root structure of the kubectl plugin manifest.
type Plugin ¶
type Plugin struct { // Name of the command for the help text. Required. Name string `json:"name"` // Use is the one-line description of how the command is used. Use string `json:"use"` // ShortDesc is a one-line description of the command. Required. ShortDesc string `json:"shortDesc"` // LongDesc is the optional full description of the command. LongDesc string `json:"longDesc,omitempty"` // Example contains optional examples of how to use the command. Example string `json:"example,omitempty"` // Command that the kubectl plugin runner should execute. Required. Command string `json:"command"` // Flags supported by the command. Flags []Flag `json:"flags,omitempty"` // Tree of child commands. Tree []Plugin `json:"tree,omitempty"` }
Plugin describes a command exposed by the plugin.
Click to show internal directories.
Click to hide internal directories.