agent

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConfig = Config{
		DockerEndpoint:        "unix:///var/run/docker.sock",
		DockerTimeout:         30 * time.Second,
		StreamIdleTimeout:     10 * time.Minute,
		StreamCreationTimeout: 15 * time.Second,

		ListenAddress: "0.0.0.0:10027",
	}
)

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"`
}

func Load

func Load(s string) (*Config, error)

func LoadFile

func LoadFile(filename string) (*Config, error)

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 NewServer

func NewServer(config *Config) (*Server, error)

func (*Server) Healthz

func (s *Server) Healthz(w http.ResponseWriter, req *http.Request)

func (*Server) Run

func (s *Server) Run() error

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.

Jump to

Keyboard shortcuts

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