plugin

package
v0.1.42 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

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

func BindEnvironmentVariables(vip *viper.Viper, cmd *cobra.Command)

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.

func IsPlugin

func IsPlugin() bool

IsPlugin determines if the cli is running as a kubectl plugin

func NewInstallCmd

func NewInstallCmd(cxt *command.Context) *cobra.Command

NewInstallCmd builds a "svcat install plugin" command

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.

func (*Manifest) Load

func (m *Manifest) Load(rootCmd *cobra.Command)

Load a cli command into the plugin manifest structure.

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.

Jump to

Keyboard shortcuts

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