cmd

package
v0.0.0-...-a2ef928 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: Apache-2.0 Imports: 118 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EvictionKind        = "Eviction"
	EvictionSubresource = "pods/eviction"
)

Variables

This section is empty.

Functions

func DefaultConsumeRequest

func DefaultConsumeRequest(request *rest.Request, out io.Writer) error

func NewCmdAlpha

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

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

func NewCmdAnnotate

func NewCmdAnnotate(parent string, f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdApiResources

func NewCmdApiResources(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdApiVersions

func NewCmdApiVersions(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdApply

func NewCmdApply(baseName string, f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdApplyEditLastApplied

func NewCmdApplyEditLastApplied(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdApplySetLastApplied

func NewCmdApplySetLastApplied(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdApplyViewLastApplied

func NewCmdApplyViewLastApplied(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdAttach

func NewCmdAttach(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdAutoscale

func NewCmdAutoscale(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdCertificate

func NewCmdCertificate(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdCertificateApprove

func NewCmdCertificateApprove(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdCertificateDeny

func NewCmdCertificateDeny(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdClusterInfo

func NewCmdClusterInfo(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdClusterInfoDump

func NewCmdClusterInfoDump(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

NewCmdCreateSecret groups subcommands to create various types of secrets

func NewCmdCompletion

func NewCmdCompletion(out io.Writer, boilerPlate string) *cobra.Command

func NewCmdConvert

func NewCmdConvert(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

NewCmdConvert creates a command object for the generic "convert" action, which translates the config file into a given version.

func NewCmdCordon

func NewCmdCordon(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdCp

func NewCmdCp(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

NewCmdCp creates a new Copy command.

func NewCmdDelete

func NewCmdDelete(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdDescribe

func NewCmdDescribe(parent string, f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdDiff

func NewCmdDiff(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdDrain

func NewCmdDrain(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdEdit

func NewCmdEdit(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdExec

func NewCmdExec(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdExplain

func NewCmdExplain(parent string, f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

NewCmdExplain returns a cobra command for swagger docs

func NewCmdExposeService

func NewCmdExposeService(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdHelp

func NewCmdHelp() *cobra.Command

func NewCmdLabel

func NewCmdLabel(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdLogs

func NewCmdLogs(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

NewCmdLogs creates a new pod logs command

func NewCmdOptions

func NewCmdOptions(out io.Writer) *cobra.Command

NewCmdOptions implements the options command

func NewCmdPatch

func NewCmdPatch(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdPlugin

func NewCmdPlugin(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdPluginList

func NewCmdPluginList(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

NewCmdPluginList provides a way to list all plugin executables visible to kubectl

func NewCmdPortForward

func NewCmdPortForward(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdProxy

func NewCmdProxy(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdReplace

func NewCmdReplace(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdRollingUpdate

func NewCmdRollingUpdate(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdRun

func NewCmdRun(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdScale

func NewCmdScale(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

NewCmdScale returns a cobra command with the appropriate configuration and flags to run scale

func NewCmdTaint

func NewCmdTaint(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdTop

func NewCmdTop(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func NewCmdUncordon

func NewCmdUncordon(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewCmdVersion

func NewCmdVersion(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

func NewDefaultKubectlCommand

func NewDefaultKubectlCommand() *cobra.Command

func NewDefaultKubectlCommandWithArgs

func NewDefaultKubectlCommandWithArgs(pluginHandler PluginHandler, args []string, in io.Reader, out, errout io.Writer) *cobra.Command

func NewKubectlCommand

func NewKubectlCommand(in io.Reader, out, err io.Writer) *cobra.Command

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

func RunCompletion

func RunCompletion(out io.Writer, boilerPlate string, cmd *cobra.Command, args []string) error

func RunDiff

func RunDiff(f cmdutil.Factory, diff *DiffProgram, options *DiffOptions, from, to string) error

RunDiff uses the factory to parse file arguments, find the version to diff, and find each Info object for each files, and runs against the differ.

func RunHelp

func RunHelp(cmd *cobra.Command, args []string)

func RunProxy

func RunProxy(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error

func ScaleJob

func ScaleJob(info *resource.Info, jobsClient batchclient.JobsGetter, count uint, preconditions *kubectl.ScalePrecondition, retry, waitForReplicas *kubectl.RetryParams) error

func SupportEviction

func SupportEviction(clientset kubernetes.Interface) (string, error)

SupportEviction uses Discovery API to find out if the server support eviction subresource If support, it will return its groupVersion; Otherwise, it will return ""

func SupportedMetricsAPIVersionAvailable

func SupportedMetricsAPIVersionAvailable(discoveredAPIGroups *metav1.APIGroupList) bool

Types

type AnnotateOptions

type AnnotateOptions struct {
	PrintFlags *genericclioptions.PrintFlags
	PrintObj   printers.ResourcePrinterFunc

	// Filename options
	resource.FilenameOptions
	RecordFlags *genericclioptions.RecordFlags

	Recorder genericclioptions.Recorder

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

AnnotateOptions have the data required to perform the annotate operation

func NewAnnotateOptions

func NewAnnotateOptions(ioStreams genericclioptions.IOStreams) *AnnotateOptions

func (*AnnotateOptions) Complete

func (o *AnnotateOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

Complete adapts from the command line args and factory to the data required.

func (AnnotateOptions) RunAnnotate

func (o AnnotateOptions) RunAnnotate() error

RunAnnotate does the work

func (AnnotateOptions) Validate

func (o AnnotateOptions) Validate() error

Validate checks to the AnnotateOptions to see if there is sufficient information run the command.

type ApiResourcesOptions

type ApiResourcesOptions struct {
	Output     string
	APIGroup   string
	Namespaced bool
	Verbs      []string
	NoHeaders  bool
	Cached     bool

	genericclioptions.IOStreams
}

ApiResourcesOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()

func NewAPIResourceOptions

func NewAPIResourceOptions(ioStreams genericclioptions.IOStreams) *ApiResourcesOptions

func (*ApiResourcesOptions) RunApiResources

func (o *ApiResourcesOptions) RunApiResources(cmd *cobra.Command, f cmdutil.Factory) error

func (*ApiResourcesOptions) Validate

func (o *ApiResourcesOptions) Validate(cmd *cobra.Command) error

type ApiVersionsOptions

type ApiVersionsOptions struct {
	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

func NewApiVersionsOptions

func NewApiVersionsOptions(ioStreams genericclioptions.IOStreams) *ApiVersionsOptions

func (*ApiVersionsOptions) Complete

func (o *ApiVersionsOptions) Complete(f cmdutil.Factory) error

func (*ApiVersionsOptions) RunApiVersions

func (o *ApiVersionsOptions) RunApiVersions() error

type ApplyOptions

type ApplyOptions struct {
	RecordFlags *genericclioptions.RecordFlags
	Recorder    genericclioptions.Recorder

	PrintFlags *genericclioptions.PrintFlags
	ToPrinter  func(string) (printers.ResourcePrinter, error)

	DeleteFlags   *DeleteFlags
	DeleteOptions *DeleteOptions

	Selector       string
	DryRun         bool
	ServerDryRun   bool
	Prune          bool
	PruneResources []pruneResource

	All                        bool
	Overwrite                  bool
	OpenApiPatch               bool
	PruneWhitelist             []string
	ShouldIncludeUninitialized bool

	Validator     validation.Schema
	Builder       *resource.Builder
	Mapper        meta.RESTMapper
	DynamicClient dynamic.Interface
	OpenAPISchema openapi.Resources

	Namespace        string
	EnforceNamespace bool

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

func NewApplyOptions

func NewApplyOptions(ioStreams genericclioptions.IOStreams) *ApplyOptions

func (*ApplyOptions) Complete

func (o *ApplyOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error

func (*ApplyOptions) Run

func (o *ApplyOptions) Run() error

type AttachOptions

type AttachOptions struct {
	StreamOptions

	// whether to disable use of standard error when streaming output from tty
	DisableStderr bool

	CommandName       string
	SuggestedCmdUsage string

	Pod *corev1.Pod

	AttachFunc      func(*AttachOptions, *corev1.Container, bool, remotecommand.TerminalSizeQueue) func() error
	Resources       []string
	Builder         func() *resource.Builder
	AttachablePodFn polymorphichelpers.AttachableLogsForObjectFunc

	Attach        RemoteAttach
	GetPodTimeout time.Duration
	Config        *restclient.Config
	// contains filtered or unexported fields
}

AttachOptions declare the arguments accepted by the Exec command

func NewAttachOptions

func NewAttachOptions(streams genericclioptions.IOStreams) *AttachOptions

func (*AttachOptions) Complete

func (o *AttachOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

Complete verifies command line arguments and loads data from the command environment

func (*AttachOptions) GetContainerName

func (o *AttachOptions) GetContainerName(pod *corev1.Pod) (string, error)

GetContainerName returns the name of the container to attach to, with a fallback.

func (*AttachOptions) Run

func (o *AttachOptions) Run() error

Run executes a validated remote execution against a pod.

func (*AttachOptions) Validate

func (o *AttachOptions) Validate() error

Validate checks that the provided attach options are specified.

type AutoscaleOptions

type AutoscaleOptions struct {
	FilenameOptions *resource.FilenameOptions

	RecordFlags *genericclioptions.RecordFlags
	Recorder    genericclioptions.Recorder

	PrintFlags *genericclioptions.PrintFlags
	ToPrinter  func(string) (printers.ResourcePrinter, error)

	Name       string
	Generator  string
	Min        int32
	Max        int32
	CpuPercent int32

	HPAClient autoscalingv1client.HorizontalPodAutoscalersGetter

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

func NewAutoscaleOptions

func NewAutoscaleOptions(ioStreams genericclioptions.IOStreams) *AutoscaleOptions

func (*AutoscaleOptions) Complete

func (o *AutoscaleOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (*AutoscaleOptions) Run

func (o *AutoscaleOptions) Run() error

func (*AutoscaleOptions) Validate

func (o *AutoscaleOptions) Validate() error

type CertificateOptions

type CertificateOptions struct {
	resource.FilenameOptions

	PrintFlags *genericclioptions.PrintFlags
	PrintObj   printers.ResourcePrinterFunc

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

func (*CertificateOptions) Complete

func (o *CertificateOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (*CertificateOptions) RunCertificateApprove

func (o *CertificateOptions) RunCertificateApprove(force bool) error

func (*CertificateOptions) RunCertificateDeny

func (o *CertificateOptions) RunCertificateDeny(force bool) error

func (*CertificateOptions) Validate

func (o *CertificateOptions) Validate() error

type ClusterInfoDumpOptions

type ClusterInfoDumpOptions struct {
	PrintFlags *genericclioptions.PrintFlags
	PrintObj   printers.ResourcePrinterFunc

	OutputDir     string
	AllNamespaces bool
	Namespaces    []string

	Timeout          time.Duration
	AppsClient       appsv1client.AppsV1Interface
	CoreClient       corev1client.CoreV1Interface
	Namespace        string
	RESTClientGetter genericclioptions.RESTClientGetter
	LogsForObject    polymorphichelpers.LogsForObjectFunc

	genericclioptions.IOStreams
}

func (*ClusterInfoDumpOptions) Complete

func (*ClusterInfoDumpOptions) Run

func (o *ClusterInfoDumpOptions) Run() error

type ClusterInfoOptions

type ClusterInfoOptions struct {
	genericclioptions.IOStreams

	Namespace string

	Builder *resource.Builder
	Client  *restclient.Config
}

func (*ClusterInfoOptions) Complete

func (o *ClusterInfoOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error

func (*ClusterInfoOptions) Run

func (o *ClusterInfoOptions) Run() error

type CommandOverrideVerifier

type CommandOverrideVerifier struct {
	// contains filtered or unexported fields
}

func (*CommandOverrideVerifier) Verify

func (v *CommandOverrideVerifier) Verify(path string) []error

Verify implements PathVerifier and determines if a given path is valid depending on whether or not it overwrites an existing kubectl command path, or a previously seen plugin.

type ConvertOptions

type ConvertOptions struct {
	PrintFlags *genericclioptions.PrintFlags
	Printer    printers.ResourcePrinter

	OutputVersion string
	Namespace     string

	resource.FilenameOptions
	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

ConvertOptions have the data required to perform the convert operation

func NewConvertOptions

func NewConvertOptions(ioStreams genericclioptions.IOStreams) *ConvertOptions

func (*ConvertOptions) Complete

func (o *ConvertOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) (err error)

Complete collects information required to run Convert command from command line.

func (*ConvertOptions) RunConvert

func (o *ConvertOptions) RunConvert() error

RunConvert implements the generic Convert command

type CopyOptions

type CopyOptions struct {
	Container string
	Namespace string

	ClientConfig *restclient.Config
	Clientset    kubernetes.Interface

	genericclioptions.IOStreams
}

func NewCopyOptions

func NewCopyOptions(ioStreams genericclioptions.IOStreams) *CopyOptions

func (*CopyOptions) Complete

func (o *CopyOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error

func (*CopyOptions) Run

func (o *CopyOptions) Run(args []string) error

func (*CopyOptions) Validate

func (o *CopyOptions) Validate(cmd *cobra.Command, args []string) error

type DefaultRemoteAttach

type DefaultRemoteAttach struct{}

DefaultRemoteAttach is the standard implementation of attaching

func (*DefaultRemoteAttach) Attach

func (*DefaultRemoteAttach) Attach(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error

type DefaultRemoteExecutor

type DefaultRemoteExecutor struct{}

DefaultRemoteExecutor is the standard implementation of remote command execution

func (*DefaultRemoteExecutor) Execute

func (*DefaultRemoteExecutor) Execute(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error

type DeleteFlags

type DeleteFlags struct {
	FileNameFlags *genericclioptions.FileNameFlags
	LabelSelector *string
	FieldSelector *string

	All            *bool
	Cascade        *bool
	Force          *bool
	GracePeriod    *int
	IgnoreNotFound *bool
	Now            *bool
	Timeout        *time.Duration
	Wait           *bool
	Output         *string
}

PrintFlags composes common printer flag structs used for commands requiring deletion logic.

func NewDeleteCommandFlags

func NewDeleteCommandFlags(usage string) *DeleteFlags

NewDeleteCommandFlags provides default flags and values for use with the "delete" command

func NewDeleteFlags

func NewDeleteFlags(usage string) *DeleteFlags

NewDeleteFlags provides default flags and values for use in commands outside of "delete"

func (*DeleteFlags) AddFlags

func (f *DeleteFlags) AddFlags(cmd *cobra.Command)

func (*DeleteFlags) ToOptions

func (f *DeleteFlags) ToOptions(dynamicClient dynamic.Interface, streams genericclioptions.IOStreams) *DeleteOptions

type DeleteOptions

type DeleteOptions struct {
	resource.FilenameOptions

	LabelSelector   string
	FieldSelector   string
	DeleteAll       bool
	IgnoreNotFound  bool
	Cascade         bool
	DeleteNow       bool
	ForceDeletion   bool
	WaitForDeletion bool

	GracePeriod int
	Timeout     time.Duration

	Output string

	DynamicClient dynamic.Interface
	Mapper        meta.RESTMapper
	Result        *resource.Result

	genericclioptions.IOStreams
}

func (*DeleteOptions) Complete

func (o *DeleteOptions) Complete(f cmdutil.Factory, args []string, cmd *cobra.Command) error

func (*DeleteOptions) DeleteResult

func (o *DeleteOptions) DeleteResult(r *resource.Result) error

func (*DeleteOptions) PrintObj

func (o *DeleteOptions) PrintObj(info *resource.Info)

deletion printing is special because we do not have an object to print. This mirrors name printer behavior

func (*DeleteOptions) RunDelete

func (o *DeleteOptions) RunDelete() error

func (*DeleteOptions) Validate

func (o *DeleteOptions) Validate(cmd *cobra.Command) error

type DescribeOptions

type DescribeOptions struct {
	CmdParent string
	Selector  string
	Namespace string

	Describer  func(*meta.RESTMapping) (printers.Describer, error)
	NewBuilder func() *resource.Builder

	BuilderArgs []string

	EnforceNamespace     bool
	AllNamespaces        bool
	IncludeUninitialized bool

	DescriberSettings *printers.DescriberSettings
	FilenameOptions   *resource.FilenameOptions

	genericclioptions.IOStreams
}

func (*DescribeOptions) Complete

func (o *DescribeOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (*DescribeOptions) DescribeMatchingResources

func (o *DescribeOptions) DescribeMatchingResources(originalError error, resource, prefix string) error

func (*DescribeOptions) Run

func (o *DescribeOptions) Run() error

func (*DescribeOptions) Validate

func (o *DescribeOptions) Validate(args []string) error

type DiffOptions

type DiffOptions struct {
	FilenameOptions resource.FilenameOptions
}

type DiffProgram

type DiffProgram struct {
	Exec exec.Interface
	genericclioptions.IOStreams
}

DiffProgram finds and run the diff program. The value of KUBERNETES_EXTERNAL_DIFF environment variable will be used a diff program. By default, `diff(1)` will be used.

func (*DiffProgram) Run

func (d *DiffProgram) Run(from, to string) error

Run runs the detected diff program. `from` and `to` are the directory to diff.

type DiffVersion

type DiffVersion struct {
	Dir  *Directory
	Name string
}

DiffVersion gets the proper version of objects, and aggregate them into a directory.

func NewDiffVersion

func NewDiffVersion(name string) (*DiffVersion, error)

NewDiffVersion creates a new DiffVersion with the named version.

func (*DiffVersion) Print

func (v *DiffVersion) Print(obj Object, printer Printer) error

Print prints the object using the printer into a new file in the directory.

type Differ

type Differ struct {
	From *DiffVersion
	To   *DiffVersion
}

Differ creates two DiffVersion and diffs them.

func NewDiffer

func NewDiffer(from, to string) (*Differ, error)

func (*Differ) Diff

func (d *Differ) Diff(obj Object, printer Printer) error

Diff diffs to versions of a specific object, and print both versions to directories.

func (*Differ) Run

func (d *Differ) Run(diff *DiffProgram) error

Run runs the diff program against both directories.

func (*Differ) TearDown

func (d *Differ) TearDown()

TearDown removes both temporary directories recursively.

type Directory

type Directory struct {
	Name string
}

Directory creates a new temp directory, and allows to easily create new files.

func CreateDirectory

func CreateDirectory(prefix string) (*Directory, error)

CreateDirectory does create the actual disk directory, and return a new representation of it.

func (*Directory) Delete

func (d *Directory) Delete() error

Delete removes the directory recursively.

func (*Directory) NewFile

func (d *Directory) NewFile(name string) (*os.File, error)

NewFile creates a new file in the directory.

type Downloader

type Downloader struct {
	// contains filtered or unexported fields
}

func NewDownloader

func NewDownloader(f cmdutil.Factory) (*Downloader, error)

func (*Downloader) Download

func (d *Downloader) Download(info *resource.Info) (*unstructured.Unstructured, error)

type DrainOptions

type DrainOptions struct {
	PrintFlags *genericclioptions.PrintFlags
	ToPrinter  func(string) (printers.ResourcePrinterFunc, error)

	Namespace string

	Force              bool
	DryRun             bool
	GracePeriodSeconds int
	IgnoreDaemonsets   bool
	Timeout            time.Duration

	DeleteLocalData bool
	Selector        string
	PodSelector     string

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

func NewDrainOptions

func NewDrainOptions(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *DrainOptions

func (*DrainOptions) Complete

func (o *DrainOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

Complete populates some fields from the factory, grabs command line arguments and looks up the node using Builder

func (*DrainOptions) RunCordonOrUncordon

func (o *DrainOptions) RunCordonOrUncordon(desired bool) error

RunCordonOrUncordon runs either Cordon or Uncordon. The desired value for "Unschedulable" is passed as the first arg.

func (*DrainOptions) RunDrain

func (o *DrainOptions) RunDrain() error

RunDrain runs the 'drain' command

type ExecOptions

type ExecOptions struct {
	StreamOptions

	Command []string

	FullCmdName       string
	SuggestedCmdUsage string

	Executor  RemoteExecutor
	PodClient coreclient.PodsGetter
	Config    *restclient.Config
}

ExecOptions declare the arguments accepted by the Exec command

func (*ExecOptions) Complete

func (p *ExecOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, argsIn []string, argsLenAtDash int) error

Complete verifies command line arguments and loads data from the command environment

func (*ExecOptions) Run

func (p *ExecOptions) Run() error

Run executes a validated remote execution against a pod.

func (*ExecOptions) Validate

func (p *ExecOptions) Validate() error

Validate checks that the provided exec options are specified.

type ExplainOptions

type ExplainOptions struct {
	genericclioptions.IOStreams

	CmdParent  string
	ApiVersion string
	Recursive  bool

	Mapper meta.RESTMapper
	Schema openapi.Resources
}

func NewExplainOptions

func NewExplainOptions(parent string, streams genericclioptions.IOStreams) *ExplainOptions

func (*ExplainOptions) Complete

func (o *ExplainOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error

func (*ExplainOptions) Run

func (o *ExplainOptions) Run(args []string) error

Run executes the appropriate steps to print a model's documentation

func (*ExplainOptions) Validate

func (o *ExplainOptions) Validate(args []string) error

type ExposeServiceOptions

type ExposeServiceOptions struct {
	FilenameOptions resource.FilenameOptions
	RecordFlags     *genericclioptions.RecordFlags
	PrintFlags      *genericclioptions.PrintFlags
	PrintObj        printers.ResourcePrinterFunc

	DryRun           bool
	EnforceNamespace bool

	Generators                func(string) map[string]kubectl.Generator
	CanBeExposed              polymorphichelpers.CanBeExposedFunc
	MapBasedSelectorForObject func(runtime.Object) (string, error)
	PortsForObject            polymorphichelpers.PortsForObjectFunc
	ProtocolsForObject        func(runtime.Object) (map[string]string, error)

	Namespace string
	Mapper    meta.RESTMapper

	DynamicClient dynamic.Interface
	Builder       *resource.Builder

	Recorder genericclioptions.Recorder
	genericclioptions.IOStreams
}

func NewExposeServiceOptions

func NewExposeServiceOptions(ioStreams genericclioptions.IOStreams) *ExposeServiceOptions

func (*ExposeServiceOptions) Complete

func (o *ExposeServiceOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error

func (*ExposeServiceOptions) RunExpose

func (o *ExposeServiceOptions) RunExpose(cmd *cobra.Command, args []string) error

type HeapsterTopOptions

type HeapsterTopOptions struct {
	Namespace string
	Service   string
	Scheme    string
	Port      string
}

func (*HeapsterTopOptions) Bind

func (o *HeapsterTopOptions) Bind(flags *pflag.FlagSet)

type InfoObject

type InfoObject struct {
	Remote  *unstructured.Unstructured
	Info    *resource.Info
	Encoder runtime.Encoder
	Parser  *parse.Factory
}

InfoObject is an implementation of the Object interface. It gets all the information from the Info object.

func (InfoObject) Last

func (obj InfoObject) Last() (map[string]interface{}, error)

func (InfoObject) Live

func (obj InfoObject) Live() (map[string]interface{}, error)

func (InfoObject) Local

func (obj InfoObject) Local() (map[string]interface{}, error)

func (InfoObject) Merged

func (obj InfoObject) Merged() (map[string]interface{}, error)

func (InfoObject) Name

func (obj InfoObject) Name() string

type LabelOptions

type LabelOptions struct {
	// Filename options
	resource.FilenameOptions
	RecordFlags *genericclioptions.RecordFlags

	PrintFlags *genericclioptions.PrintFlags
	ToPrinter  func(string) (printers.ResourcePrinter, error)

	Recorder genericclioptions.Recorder

	// Common shared fields
	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

LabelOptions have the data required to perform the label operation

func NewLabelOptions

func NewLabelOptions(ioStreams genericclioptions.IOStreams) *LabelOptions

func (*LabelOptions) Complete

func (o *LabelOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

Complete adapts from the command line args and factory to the data required.

func (*LabelOptions) RunLabel

func (o *LabelOptions) RunLabel() error

RunLabel does the work

func (*LabelOptions) Validate

func (o *LabelOptions) Validate() error

Validate checks to the LabelOptions to see if there is sufficient information run the command.

type LogsOptions

type LogsOptions struct {
	Namespace     string
	ResourceArg   string
	AllContainers bool
	Options       runtime.Object
	Resources     []string

	ConsumeRequestFn func(*rest.Request, io.Writer) error

	// PodLogOptions
	SinceTime    string
	SinceSeconds time.Duration
	Follow       bool
	Previous     bool
	Timestamps   bool
	LimitBytes   int64
	Tail         int64
	Container    string

	// whether or not a container name was given via --container
	ContainerNameSpecified bool
	Selector               string

	Object           runtime.Object
	GetPodTimeout    time.Duration
	RESTClientGetter genericclioptions.RESTClientGetter
	LogsForObject    polymorphichelpers.LogsForObjectFunc

	genericclioptions.IOStreams
}

func NewLogsOptions

func NewLogsOptions(streams genericclioptions.IOStreams, allContainers bool) *LogsOptions

func (*LogsOptions) Complete

func (o *LogsOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (LogsOptions) RunLogs

func (o LogsOptions) RunLogs() error

RunLogs retrieves a pod log

func (*LogsOptions) ToLogOptions

func (o *LogsOptions) ToLogOptions() (*corev1.PodLogOptions, error)

func (LogsOptions) Validate

func (o LogsOptions) Validate() error

type Object

type Object interface {
	Local() (map[string]interface{}, error)
	Live() (map[string]interface{}, error)
	Last() (map[string]interface{}, error)
	Merged() (map[string]interface{}, error)

	Name() string
}

Object is an interface that let's you retrieve multiple version of it.

type PatchBuffer

type PatchBuffer struct {
	Patch     []byte
	PatchType types.PatchType
}

type PatchOptions

type PatchOptions struct {
	resource.FilenameOptions

	RecordFlags *genericclioptions.RecordFlags
	PrintFlags  *genericclioptions.PrintFlags
	ToPrinter   func(string) (printers.ResourcePrinter, error)
	Recorder    genericclioptions.Recorder

	Local     bool
	PatchType string
	Patch     string

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

PatchOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of referencing the cmd.Flags()

func NewPatchOptions

func NewPatchOptions(ioStreams genericclioptions.IOStreams) *PatchOptions

func (*PatchOptions) Complete

func (o *PatchOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (*PatchOptions) RunPatch

func (o *PatchOptions) RunPatch() error

func (*PatchOptions) Validate

func (o *PatchOptions) Validate() error

type PathVerifier

type PathVerifier interface {
	// Verify determines if a given path is valid
	Verify(path string) []error
}

pathVerifier receives a path and determines if it is valid or not

type PluginHandler

type PluginHandler interface {
	// Lookup receives a potential filename and returns
	// a full or relative path to an executable, if one
	// exists at the given filename, or an error.
	Lookup(filename string) (string, error)
	// 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.

type PluginListOptions

type PluginListOptions struct {
	Verifier PathVerifier
	NameOnly bool

	genericclioptions.IOStreams
}

func (*PluginListOptions) Complete

func (o *PluginListOptions) Complete(cmd *cobra.Command) error

func (*PluginListOptions) Run

func (o *PluginListOptions) Run() error

type PortForwardOptions

type PortForwardOptions struct {
	Namespace     string
	PodName       string
	RESTClient    *restclient.RESTClient
	Config        *restclient.Config
	PodClient     corev1client.PodsGetter
	Ports         []string
	PortForwarder portForwarder
	StopChannel   chan struct{}
	ReadyChannel  chan struct{}
}

PortForwardOptions contains all the options for running the port-forward cli command.

func (*PortForwardOptions) Complete

func (o *PortForwardOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

Complete completes all the required options for port-forward cmd.

func (PortForwardOptions) RunPortForward

func (o PortForwardOptions) RunPortForward() error

RunPortForward implements all the necessary functionality for port-forward cmd.

func (PortForwardOptions) Validate

func (o PortForwardOptions) Validate() error

Validate validates all the required options for port-forward cmd.

type Printer

type Printer struct{}

Printer is used to print an object.

func (*Printer) Print

func (p *Printer) Print(obj map[string]interface{}, w io.Writer) error

Print the object inside the writer w.

type RemoteAttach

type RemoteAttach interface {
	Attach(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error
}

RemoteAttach defines the interface accepted by the Attach command - provided for test stubbing

type RemoteExecutor

type RemoteExecutor interface {
	Execute(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error
}

RemoteExecutor defines the interface accepted by the Exec command - provided for test stubbing

type ReplaceOptions

type ReplaceOptions struct {
	PrintFlags  *genericclioptions.PrintFlags
	DeleteFlags *DeleteFlags
	RecordFlags *genericclioptions.RecordFlags

	DeleteOptions *DeleteOptions

	PrintObj func(obj runtime.Object) error

	Schema      validation.Schema
	Builder     func() *resource.Builder
	BuilderArgs []string

	Namespace        string
	EnforceNamespace bool

	Recorder genericclioptions.Recorder

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

func NewReplaceOptions

func NewReplaceOptions(streams genericclioptions.IOStreams) *ReplaceOptions

func (*ReplaceOptions) Complete

func (o *ReplaceOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (*ReplaceOptions) Run

func (o *ReplaceOptions) Run() error

func (*ReplaceOptions) Validate

func (o *ReplaceOptions) Validate(cmd *cobra.Command) error

type RollingUpdateOptions

type RollingUpdateOptions struct {
	FilenameOptions *resource.FilenameOptions

	OldName     string
	KeepOldName bool

	DeploymentKey    string
	Image            string
	Container        string
	PullPolicy       string
	Rollback         bool
	Period           time.Duration
	Timeout          time.Duration
	Interval         time.Duration
	DryRun           bool
	OutputFormat     string
	Namespace        string
	EnforceNamespace bool

	ScaleClient scaleclient.ScalesGetter
	ClientSet   kubernetes.Interface
	Builder     *resource.Builder

	ShouldValidate bool
	Validator      func(bool) (validation.Schema, error)

	FindNewName func(*corev1.ReplicationController) string

	PrintFlags *genericclioptions.PrintFlags
	ToPrinter  func(string) (printers.ResourcePrinter, error)

	genericclioptions.IOStreams
}

func NewRollingUpdateOptions

func NewRollingUpdateOptions(streams genericclioptions.IOStreams) *RollingUpdateOptions

func (*RollingUpdateOptions) Complete

func (o *RollingUpdateOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (*RollingUpdateOptions) Run

func (o *RollingUpdateOptions) Run() error

func (*RollingUpdateOptions) Validate

func (o *RollingUpdateOptions) Validate(cmd *cobra.Command, args []string) error

type RunObject

type RunObject struct {
	Object  runtime.Object
	Mapping *meta.RESTMapping
}

type RunOptions

type RunOptions struct {
	PrintFlags    *genericclioptions.PrintFlags
	DeleteFlags   *DeleteFlags
	DeleteOptions *DeleteOptions
	RecordFlags   *genericclioptions.RecordFlags

	DryRun bool

	PrintObj func(runtime.Object) error
	Recorder genericclioptions.Recorder

	DynamicClient dynamic.Interface

	ArgsLenAtDash  int
	Attach         bool
	Expose         bool
	Generator      string
	Image          string
	Interactive    bool
	LeaveStdinOpen bool
	Port           string
	Quiet          bool
	Schedule       string
	TTY            bool

	genericclioptions.IOStreams
}

func NewRunOptions

func NewRunOptions(streams genericclioptions.IOStreams) *RunOptions

func (*RunOptions) Complete

func (o *RunOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error

func (*RunOptions) Run

func (o *RunOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) error

type ScaleOptions

type ScaleOptions struct {
	FilenameOptions resource.FilenameOptions
	RecordFlags     *genericclioptions.RecordFlags
	PrintFlags      *genericclioptions.PrintFlags
	PrintObj        printers.ResourcePrinterFunc

	Selector        string
	All             bool
	Replicas        int
	ResourceVersion string
	CurrentReplicas int
	Timeout         time.Duration

	Recorder genericclioptions.Recorder

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

func NewScaleOptions

func NewScaleOptions(ioStreams genericclioptions.IOStreams) *ScaleOptions

func (*ScaleOptions) Complete

func (o *ScaleOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (*ScaleOptions) RunScale

func (o *ScaleOptions) RunScale() error

RunScale executes the scaling

func (*ScaleOptions) Validate

func (o *ScaleOptions) Validate(cmd *cobra.Command) error

type SetLastAppliedOptions

type SetLastAppliedOptions struct {
	CreateAnnotation bool

	PrintFlags *genericclioptions.PrintFlags
	PrintObj   printers.ResourcePrinterFunc

	FilenameOptions resource.FilenameOptions

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

func NewSetLastAppliedOptions

func NewSetLastAppliedOptions(ioStreams genericclioptions.IOStreams) *SetLastAppliedOptions

func (*SetLastAppliedOptions) Complete

func (o *SetLastAppliedOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error

func (*SetLastAppliedOptions) RunSetLastApplied

func (o *SetLastAppliedOptions) RunSetLastApplied() error

func (*SetLastAppliedOptions) Validate

func (o *SetLastAppliedOptions) Validate() error

type StreamOptions

type StreamOptions struct {
	Namespace     string
	PodName       string
	ContainerName string
	Stdin         bool
	TTY           bool
	// minimize unnecessary output
	Quiet bool
	// InterruptParent, if set, is used to handle interrupts while attached
	InterruptParent *interrupt.Handler

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

type TaintOptions

type TaintOptions struct {
	PrintFlags *genericclioptions.PrintFlags
	ToPrinter  func(string) (printers.ResourcePrinter, error)

	ClientForMapping func(*meta.RESTMapping) (resource.RESTClient, error)

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

TaintOptions have the data required to perform the taint operation

func (*TaintOptions) Complete

func (o *TaintOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) (err error)

Complete adapts from the command line args and factory to the data required.

func (TaintOptions) RunTaint

func (o TaintOptions) RunTaint() error

RunTaint does the work

func (TaintOptions) Validate

func (o TaintOptions) Validate() error

Validate checks to the TaintOptions to see if there is sufficient information run the command.

type TopNodeOptions

type TopNodeOptions struct {
	ResourceName    string
	Selector        string
	NodeClient      corev1client.CoreV1Interface
	HeapsterOptions HeapsterTopOptions
	Client          *metricsutil.HeapsterMetricsClient
	Printer         *metricsutil.TopCmdPrinter
	DiscoveryClient discovery.DiscoveryInterface
	MetricsClient   metricsclientset.Interface

	genericclioptions.IOStreams
}

TopNodeOptions contains all the options for running the top-node cli command.

func (*TopNodeOptions) Complete

func (o *TopNodeOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (TopNodeOptions) RunTopNode

func (o TopNodeOptions) RunTopNode() error

func (*TopNodeOptions) Validate

func (o *TopNodeOptions) Validate() error

type TopPodOptions

type TopPodOptions struct {
	ResourceName    string
	Namespace       string
	Selector        string
	AllNamespaces   bool
	PrintContainers bool
	PodClient       corev1client.PodsGetter
	HeapsterOptions HeapsterTopOptions
	Client          *metricsutil.HeapsterMetricsClient
	Printer         *metricsutil.TopCmdPrinter
	DiscoveryClient discovery.DiscoveryInterface
	MetricsClient   metricsclientset.Interface

	genericclioptions.IOStreams
}

func (*TopPodOptions) Complete

func (o *TopPodOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (TopPodOptions) RunTopPod

func (o TopPodOptions) RunTopPod() error

func (*TopPodOptions) Validate

func (o *TopPodOptions) Validate() error

type Version

type Version struct {
	ClientVersion *apimachineryversion.Info `json:"clientVersion,omitempty" yaml:"clientVersion,omitempty"`
	ServerVersion *apimachineryversion.Info `json:"serverVersion,omitempty" yaml:"serverVersion,omitempty"`
}

type VersionOptions

type VersionOptions struct {
	ClientOnly bool
	Short      bool
	Output     string

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

func NewVersionOptions

func NewVersionOptions(ioStreams genericclioptions.IOStreams) *VersionOptions

func (*VersionOptions) Complete

func (o *VersionOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error

func (*VersionOptions) Run

func (o *VersionOptions) Run() error

func (*VersionOptions) Validate

func (o *VersionOptions) Validate() error

type ViewLastAppliedOptions

type ViewLastAppliedOptions struct {
	FilenameOptions              resource.FilenameOptions
	Selector                     string
	LastAppliedConfigurationList []string
	OutputFormat                 string
	All                          bool
	Factory                      cmdutil.Factory

	genericclioptions.IOStreams
}

func NewViewLastAppliedOptions

func NewViewLastAppliedOptions(ioStreams genericclioptions.IOStreams) *ViewLastAppliedOptions

func (*ViewLastAppliedOptions) Complete

func (o *ViewLastAppliedOptions) Complete(cmd *cobra.Command, f cmdutil.Factory, args []string) error

func (*ViewLastAppliedOptions) RunApplyViewLastApplied

func (o *ViewLastAppliedOptions) RunApplyViewLastApplied(cmd *cobra.Command) error

func (*ViewLastAppliedOptions) Validate

func (o *ViewLastAppliedOptions) Validate(cmd *cobra.Command) error

Directories

Path Synopsis
Package scalejob is deprecated This package contains deprecated functions used to "scale" jobs in a way inconsistent with normal scaling rules
Package scalejob is deprecated This package contains deprecated functions used to "scale" jobs in a way inconsistent with normal scaling rules
set
env
Package env provides functions to incorporate environment variables into set env.
Package env provides functions to incorporate environment variables into set env.
openapi
Package openapi is a collection of libraries for fetching the openapi spec from a Kubernetes server and then indexing the type definitions.
Package openapi is a collection of libraries for fetching the openapi spec from a Kubernetes server and then indexing the type definitions.

Jump to

Keyboard shortcuts

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