Documentation ¶
Index ¶
- Variables
- func HandleResizing(resize <-chan remotecommand.TerminalSize, ...)
- type Config
- type DebugAttacher
- func (a *DebugAttacher) AttachContainer(name string, uid kubetype.UID, container string, in io.Reader, ...) error
- func (m *DebugAttacher) AttachToContainer(container string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, ...) error
- func (m *DebugAttacher) CleanContainer(id string)
- func (m *DebugAttacher) CreateContainer(targetId string, image string, command []string) (*container.ContainerCreateCreatedBody, error)
- func (m *DebugAttacher) DebugContainer(container, image string, command []string, stdin io.Reader, ...) error
- func (m *DebugAttacher) PullImage(image string, stdout io.WriteCloser) error
- func (m *DebugAttacher) RmContainer(id string, force bool) error
- func (m *DebugAttacher) RunDebugContainer(targetId string, image string, command []string) (string, error)
- func (m *DebugAttacher) StartContainer(id string) error
- type RuntimeManager
- type Server
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func HandleResizing ¶
func HandleResizing(resize <-chan remotecommand.TerminalSize, resizeFunc func(size remotecommand.TerminalSize))
handleResizing spawns a goroutine that processes the resize channel, calling resizeFunc for each remotecommand.TerminalSize received from the channel. The resize channel must be closed elsewhere to stop the goroutine.
Types ¶
type Config ¶
type Config struct { DockerEndpoint string `yaml:"docker_endpoint,omitempty"` DockerTimeout time.Duration `yaml:"docker_timeout,omitempty"` StreamIdleTimeout time.Duration `yaml:"stream_idle_timeout,omitempty"` StreamCreationTimeout time.Duration `yaml:"stream_creation_timeout,omitempty"` ListenAddress string `yaml:"listen_address,omitempty"` }
type DebugAttacher ¶
type DebugAttacher struct {
// contains filtered or unexported fields
}
DebugAttacher implements Attacher we use this struct in order to inject debug info (image, command) in the debug procedure
func (*DebugAttacher) AttachContainer ¶
func (a *DebugAttacher) AttachContainer(name string, uid kubetype.UID, container string, in io.Reader, out, err io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error
func (*DebugAttacher) AttachToContainer ¶
func (m *DebugAttacher) AttachToContainer(container string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error
AttachToContainer do `docker attach`
func (*DebugAttacher) CleanContainer ¶
func (m *DebugAttacher) CleanContainer(id string)
func (*DebugAttacher) CreateContainer ¶
func (m *DebugAttacher) CreateContainer(targetId string, image string, command []string) (*container.ContainerCreateCreatedBody, error)
func (*DebugAttacher) DebugContainer ¶
func (m *DebugAttacher) DebugContainer(container, image string, command []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error
DebugContainer executes the main debug flow
func (*DebugAttacher) PullImage ¶
func (m *DebugAttacher) PullImage(image string, stdout io.WriteCloser) error
func (*DebugAttacher) RmContainer ¶
func (m *DebugAttacher) RmContainer(id string, force bool) error
func (*DebugAttacher) RunDebugContainer ¶
func (m *DebugAttacher) RunDebugContainer(targetId string, image string, command []string) (string, error)
Run a new container, this container will join the network, mount, and pid namespace of the given container
func (*DebugAttacher) StartContainer ¶
func (m *DebugAttacher) StartContainer(id string) error
type RuntimeManager ¶
type RuntimeManager struct {
// contains filtered or unexported fields
}
RuntimeManager is responsible for docker operation
func NewRuntimeManager ¶
func NewRuntimeManager(host string, timeout time.Duration) (*RuntimeManager, error)
func (*RuntimeManager) GetAttacher ¶
func (m *RuntimeManager) GetAttacher(image string, command []string, context context.Context, cancel context.CancelFunc) kubeletremote.Attacher
GetAttacher returns an implementation of Attacher
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ServeDebug ¶
func (s *Server) ServeDebug(w http.ResponseWriter, req *http.Request)
ServeDebug serves the debug request. first, it will upgrade the connection to SPDY. then, server will try to create the debug container, and sent creating progress to user via SPDY. after the debug container running, server attach to the debug container and pipe the streams to user. once connection closed, server killed the debug container and release related resources if any error occurs above, an error status were written to the user's stderr.