kubeserver

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 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"

	// DefaultStreamCreationTimeout
	DefaultStreamCreationTimeout = 30 * time.Second

	IdleTimeout = 15 * time.Minute
	// Name of header that specifies stream type
	StreamType = "streamType"
	// Value for streamType header for stdin stream
	StreamTypeStdin = "stdin"
	// Value for streamType header for stdout stream
	StreamTypeStdout = "stdout"
	// Value for streamType header for stderr stream
	StreamTypeStderr = "stderr"
	// Value for streamType header for data stream
	StreamTypeData = "data"
	// Value for streamType header for error stream
	StreamTypeError = "error"
	// Value for streamType header for terminal resize stream
	StreamTypeResize = "resize"

	// CloseStreamMessage is an expected keyword if stdin is enable and the
	// underlying protocol does not support half closed streams.
	// It is only required for websockets.
	CloseStreamMessage = "\r\nexit_message\r\n"

	// PortForwardPayload is the message that dummy portforward handler writes
	// into the connection before terminating the portforward connection.
	PortForwardPayload = "Portforward handler message"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type KubeMockServer

type KubeMockServer struct {
	TLS     *tls.Config
	URL     string
	Address string
	CA      []byte
	// contains filtered or unexported fields
}

func NewKubeAPIMock

func NewKubeAPIMock(opts ...Option) (*KubeMockServer, error)

NewKubeAPIMock creates Kubernetes API server for handling exec calls. For now it just supports exec via SPDY protocol and returns the following content into the available streams: {containerName}\n {stdinDump} The output returns the container followed by a dump of the data received from stdin. More endpoints can be configured TODO(tigrato): add support for other endpoints

func (*KubeMockServer) Close

func (s *KubeMockServer) Close() error

func (*KubeMockServer) DeletedClusterRoles

func (s *KubeMockServer) DeletedClusterRoles(reqID string) []string

func (*KubeMockServer) DeletedPods

func (s *KubeMockServer) DeletedPods(reqID string) []string

func (*KubeMockServer) DeletedTeleportRoles

func (s *KubeMockServer) DeletedTeleportRoles(reqID string) []string

type Option

type Option func(*KubeMockServer)

Option is a functional option for KubeMockServer

func WithExecError

func WithExecError(status metav1.Status) Option

WithExecError sets the error to be returned by the Exec call

func WithGetPodError

func WithGetPodError(status metav1.Status) Option

WithGetPodError sets the error to be returned by the GetPod call

Jump to

Keyboard shortcuts

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