kubectlk8s.io/kubectl/pkg/cmd Index | Files | Directories

package cmd

import "k8s.io/kubectl/pkg/cmd"

Index

Functions

func Command

func Command(name string, arg ...string) *exec.Cmd

func HandlePluginCommand

func HandlePluginCommand(pluginHandler PluginHandler, cmdArgs []string, minArgs int) error

HandlePluginCommand receives a pluginHandler and command-line arguments and attempts to find a plugin executable on the PATH that satisfies the given arguments.

func IsSubcommandPluginAllowed

func IsSubcommandPluginAllowed(foundCmd string) bool

IsSubcommandPluginAllowed returns the given command is allowed to use plugin as subcommand if the subcommand does not exist as builtin.

func NewCmdAlpha

func NewCmdAlpha(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewCmdAlpha creates a command that acts as an alternate root command for features in alpha

func NewDefaultKubectlCommand

func NewDefaultKubectlCommand() *cobra.Command

NewDefaultKubectlCommand creates the `kubectl` command with default arguments

func NewDefaultKubectlCommandWithArgs

func NewDefaultKubectlCommandWithArgs(o KubectlOptions) *cobra.Command

NewDefaultKubectlCommandWithArgs creates the `kubectl` command with arguments

func NewKubectlCommand

func NewKubectlCommand(o KubectlOptions) *cobra.Command

NewKubectlCommand creates the `kubectl` command and its nested children.

Types

type DefaultPluginHandler

type DefaultPluginHandler struct {
	ValidPrefixes []string
}

DefaultPluginHandler implements PluginHandler

func NewDefaultPluginHandler

func NewDefaultPluginHandler(validPrefixes []string) *DefaultPluginHandler

NewDefaultPluginHandler instantiates the DefaultPluginHandler with a list of given filename prefixes used to identify valid plugin filenames.

func (*DefaultPluginHandler) Execute

func (h *DefaultPluginHandler) Execute(executablePath string, cmdArgs, environment []string) error

Execute implements PluginHandler

func (*DefaultPluginHandler) Lookup

func (h *DefaultPluginHandler) Lookup(filename string) (string, bool)

Lookup implements PluginHandler

type KubectlOptions

type KubectlOptions struct {
	PluginHandler PluginHandler
	Arguments     []string
	ConfigFlags   *genericclioptions.ConfigFlags

	genericiooptions.IOStreams
}

type PluginHandler

type PluginHandler interface {
	// exists at the given filename, or a boolean false.
	// Lookup will iterate over a list of given prefixes
	// in order to recognize valid plugin filenames.
	// The first filepath to match a prefix is returned.
	Lookup(filename string) (string, bool)
	// Execute receives an executable's filepath, a slice
	// of arguments, and a slice of environment variables
	// to relay to the executable.
	Execute(executablePath string, cmdArgs, environment []string) error
}

PluginHandler is capable of parsing command line arguments and performing executable filename lookups to search for valid plugin files, and execute found plugins.

Source Files

alpha.go cmd.go profiling.go skiplookerr_go119.go

Directories

PathSynopsis
pkg/cmd/annotate
pkg/cmd/apiresources
pkg/cmd/apply
pkg/cmd/attach
pkg/cmd/auth
pkg/cmd/autoscale
pkg/cmd/certificates
pkg/cmd/clusterinfo
pkg/cmd/completion
pkg/cmd/config
pkg/cmd/cp
pkg/cmd/create
pkg/cmd/debug
pkg/cmd/delete
pkg/cmd/describe
pkg/cmd/diff
pkg/cmd/drain
pkg/cmd/edit
pkg/cmd/events
pkg/cmd/exec
pkg/cmd/explain
pkg/cmd/expose
pkg/cmd/get
pkg/cmd/help
pkg/cmd/kustomize
pkg/cmd/label
pkg/cmd/logs
pkg/cmd/options
pkg/cmd/patch
pkg/cmd/plugin
pkg/cmd/portforward
pkg/cmd/proxy
pkg/cmd/replace
pkg/cmd/rollout
pkg/cmd/run
pkg/cmd/scale
pkg/cmd/set
pkg/cmd/set/envPackage env provides functions to incorporate environment variables into set env.
pkg/cmd/taintPackage taints implements utilites for working with taints
pkg/cmd/testing
pkg/cmd/top
pkg/cmd/util
pkg/cmd/util/editor
pkg/cmd/util/editor/crlf
pkg/cmd/util/podcmd
pkg/cmd/util/sanity
pkg/cmd/version
pkg/cmd/wait
Version
v0.32.3 (latest)
Published
Mar 12, 2025
Platform
linux/amd64
Imports
64 packages
Last checked
5 days ago

Tools for package owners.