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 `yaml:"name"`
// Shorthand flag, must be a single character.
Shorthand string `yaml:"shorthand,omitempty"`
// Desc of the flag for the help text. Required.
Desc string `yaml:"desc"`
// DefValue is the default value to use when the flag is not specified.
DefValue string `yaml:"defValue,omitempty"`
}
Flag describes a flag exposed by a plugin command.
type Manifest ¶
type Manifest struct {
Plugin `yaml:",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 `yaml:"name"`
// Use is the one-line description of how the command is used.
Use string `yaml:"use"`
// ShortDesc is a one-line description of the command. Required.
ShortDesc string `yaml:"shortDesc"`
// LongDesc is the optional full description of the command.
LongDesc string `yaml:"longDesc,omitempty"`
// Example contains optional examples of how to use the command.
Example string `yaml:"example,omitempty"`
// Command that the kubectl plugin runner should execute. Required.
Command string `yaml:"command"`
// Flags supported by the command.
Flags []Flag `yaml:"flags,omitempty"`
// Tree of child commands.
Tree []Plugin `yaml:"tree,omitempty"`
}
Plugin describes a command exposed by the plugin.
Click to show internal directories.
Click to hide internal directories.