Documentation ¶
Overview ¶
Package remotecommand adds support for executing commands in containers, with support for separate stdin, stdout, and stderr streams, as well as TTY.
Index ¶
- type Executor
- func NewFallbackExecutor(primary, secondary Executor, shouldFallback func(error) bool) (Executor, error)
- func NewSPDYExecutor(config *restclient.Config, method string, url *url.URL) (Executor, error)
- func NewSPDYExecutorForProtocols(transport http.RoundTripper, upgrader spdy.Upgrader, method string, ...) (Executor, error)
- func NewSPDYExecutorForTransports(transport http.RoundTripper, upgrader spdy.Upgrader, method string, ...) (Executor, error)
- func NewSPDYExecutorRejectRedirects(transport http.RoundTripper, upgrader spdy.Upgrader, method string, ...) (Executor, error)
- func NewWebSocketExecutor(config *restclient.Config, method, url string) (Executor, error)
- func NewWebSocketExecutorForProtocols(config *restclient.Config, method, url string, protocols ...string) (Executor, error)
- type FallbackExecutor
- type StreamOptions
- type TerminalSize
- type TerminalSizeQueue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor interface { // Deprecated: use StreamWithContext instead to avoid possible resource leaks. // See https://github.com/kubernetes/kubernetes/pull/103177 for details. Stream(options StreamOptions) error // StreamWithContext 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. If tty is set, the stderr stream is not used (raw TTY manages stdout and // stderr over the stdout stream). // The context controls the entire lifetime of stream execution. StreamWithContext(ctx context.Context, options StreamOptions) error }
Executor is an interface for transporting shell-style streams.
func NewFallbackExecutor ¶ added in v0.29.0
func NewFallbackExecutor(primary, secondary Executor, shouldFallback func(error) bool) (Executor, error)
NewFallbackExecutor creates an Executor that first attempts to use the WebSocketExecutor, falling back to the legacy SPDYExecutor if the initial websocket "StreamWithContext" call fails. func NewFallbackExecutor(config *restclient.Config, method string, url *url.URL) (Executor, error) {
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(transport 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.
func NewSPDYExecutorRejectRedirects ¶ added in v0.29.0
func NewSPDYExecutorRejectRedirects(transport http.RoundTripper, upgrader spdy.Upgrader, method string, url *url.URL) (Executor, error)
NewSPDYExecutorRejectRedirects returns an Executor that will upgrade the future connection to a SPDY bi-directional streaming connection when calling "Stream" (deprecated) or "StreamWithContext" (preferred). Additionally, if the upstream server returns a redirect during the attempted upgrade in these "Stream" calls, an error is returned.
func NewWebSocketExecutor ¶ added in v0.29.0
func NewWebSocketExecutor(config *restclient.Config, method, url string) (Executor, error)
func NewWebSocketExecutorForProtocols ¶ added in v0.29.0
func NewWebSocketExecutorForProtocols(config *restclient.Config, method, url string, protocols ...string) (Executor, error)
NewWebSocketExecutorForProtocols allows to execute commands via a WebSocket connection.
type FallbackExecutor ¶ added in v0.30.0
type FallbackExecutor struct {
// contains filtered or unexported fields
}
func (*FallbackExecutor) Stream ¶ added in v0.30.0
func (f *FallbackExecutor) Stream(options StreamOptions) error
Stream is deprecated. Please use "StreamWithContext".
func (*FallbackExecutor) StreamWithContext ¶ added in v0.30.0
func (f *FallbackExecutor) StreamWithContext(ctx context.Context, options StreamOptions) error
StreamWithContext initially attempts to call "StreamWithContext" using the primary executor, falling back to calling the secondary executor if the initial primary call to upgrade to a websocket connection fails.
type StreamOptions ¶
type StreamOptions struct { Stdin io.Reader Stdout io.Writer Stderr io.Writer Tty bool TerminalSizeQueue TerminalSizeQueue }
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.