Documentation ¶
Index ¶
- Constants
- Variables
- type CodeExitError
- type DefaultRemoteExecutor
- type Executor
- func NewSPDYExecutor(method string, url *url.URL) (Executor, error)
- func NewSPDYExecutorForProtocols(transport http.RoundTripper, upgrader spdy.Upgrader, method string, ...) (Executor, error)
- func NewSPDYExecutorForTransports(tranport http.RoundTripper, upgrader spdy.Upgrader, method string, ...) (Executor, error)
- type ExitError
- type RemoteExecutor
- type StreamOptions
- type TerminalSize
- type TerminalSizeQueue
Constants ¶
const ( DefaultStreamCreationTimeout = 30 * time.Second // The SPDY subprotocol "channel.k8s.io" is used for remote command // attachment/execution. This represents the initial unversioned subprotocol, // which has the known bugs http://issues.k8s.io/13394 and // http://issues.k8s.io/13395. StreamProtocolV1Name = "channel.k8s.io" // The SPDY subprotocol "v2.channel.k8s.io" is used for remote command // attachment/execution. It is the second version of the subprotocol and // resolves the issues present in the first version. StreamProtocolV2Name = "v2.channel.k8s.io" // The SPDY subprotocol "v3.channel.k8s.io" is used for remote command // attachment/execution. It is the third version of the subprotocol and // adds support for resizing container terminals. StreamProtocolV3Name = "v3.channel.k8s.io" // The SPDY subprotocol "v4.channel.k8s.io" is used for remote command // attachment/execution. It is the 4th version of the subprotocol and // adds support for exit codes. StreamProtocolV4Name = "v4.channel.k8s.io" NonZeroExitCodeReason = metav1.StatusReason("NonZeroExitCode") ExitCodeCauseType = metav1.CauseType("ExitCode") )
Variables ¶
var SupportedStreamingProtocols = []string{StreamProtocolV4Name, StreamProtocolV3Name, StreamProtocolV2Name, StreamProtocolV1Name}
Functions ¶
This section is empty.
Types ¶
type CodeExitError ¶
CodeExitError is an implementation of ExitError consisting of an error object and an exit code (the upper bits of os.exec.ExitStatus).
func (CodeExitError) Error ¶
func (e CodeExitError) Error() string
func (CodeExitError) ExitStatus ¶
func (e CodeExitError) ExitStatus() int
func (CodeExitError) Exited ¶
func (e CodeExitError) Exited() bool
func (CodeExitError) String ¶
func (e CodeExitError) String() string
type DefaultRemoteExecutor ¶
type DefaultRemoteExecutor struct{}
DefaultRemoteExecutor is the standard implementation of remote command execution
type Executor ¶
type Executor interface { // Stream initiates the transport of the standard shell streams. It will transport any // non-nil stream to a remote system, and return an error if a problem occurs. Stream(options StreamOptions) error }
Executor is an interface for transporting shell-style streams.
func NewSPDYExecutor ¶
NewSPDYExecutor connects to the provided server and upgrades the connection to multiplexed bidirectional streams.
func NewSPDYExecutorForProtocols ¶
func NewSPDYExecutorForProtocols(transport http.RoundTripper, upgrader spdy.Upgrader, method string, url *url.URL, protocols ...string) (Executor, error)
NewSPDYExecutorForProtocols connects to the provided server and upgrades the connection to multiplexed bidirectional streams using only the provided protocols. Exposed for testing, most callers should use NewSPDYExecutor or NewSPDYExecutorForTransports.
func NewSPDYExecutorForTransports ¶
func NewSPDYExecutorForTransports(tranport http.RoundTripper, upgrader spdy.Upgrader, method string, url *url.URL) (Executor, error)
NewSPDYExecutorForTransports connects to the provided server using the given transport, upgrades the response using the given upgrader to multiplexed bidirectional streams.
type ExitError ¶
ExitError is an interface that presents an API similar to os.ProcessState, which is what ExitError from os/exec is. This is designed to make testing a bit easier and probably loses some of the cross-platform properties of the underlying library.
type RemoteExecutor ¶
type RemoteExecutor interface {
Execute(method string, url *url.URL, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue TerminalSizeQueue) error
}
RemoteExecutor defines the interface accepted by the Exec command
func NewDefaultRemoteExecutor ¶
func NewDefaultRemoteExecutor() RemoteExecutor
type StreamOptions ¶
type StreamOptions struct { Stdin io.Reader Stdout io.Writer Stderr io.Writer Tty bool TerminalSizeQueue TerminalSizeQueue Header http.Header }
StreamOptions holds information pertaining to the current streaming session: input/output streams, if the client is requesting a TTY, and a terminal size queue to support terminal resizing.
type TerminalSize ¶
TerminalSize represents the width and height of a terminal
type TerminalSizeQueue ¶
type TerminalSizeQueue interface { // Next returns the new terminal size after the terminal has been resized. It returns nil when // monitoring has been stopped. Next() *TerminalSize }
TerminalSizeQueue is capable of returning terminal resize events as they occur.