plugin

package
v0.1.37 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 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 `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.

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 `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.

Jump to

Keyboard shortcuts

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