podexec

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 20 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StdStreams added in v0.10.0

func StdStreams() (stdIn io.ReadCloser, stdOut, stdErr io.Writer)

StdStreams returns the standard streams (stdin, stdout, stderr).

Types

type AttachPodArgs added in v0.8.0

type AttachPodArgs struct {
	Options          *ExecOptions
	Command          []string
	CmdArgsLenAtDash int
}

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 ExecOptions

type ExecOptions struct {
	StreamOptions

	ResourceName string
	Command      []string

	ParentCommandName       string
	EnableSuggestedCmdUsage bool

	Builder         func() *resource.Builder
	ExecutablePodFn polymorphichelpers.AttachablePodForObjectFunc

	Pod           *corev1.Pod
	Executor      RemoteExecutor
	PodClient     coreclient.PodsGetter
	GetPodTimeout time.Duration
	Config        *restclient.Config
}

ExecOptions declare the arguments accepted by the Exec command

func (*ExecOptions) Complete

func (p *ExecOptions) Complete(argsIn []string, namespace 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 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 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
}

func (*StreamOptions) SetupTTY

func (o *StreamOptions) SetupTTY() term.TTY

Jump to

Keyboard shortcuts

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