runsc

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

View Source
const DefaultCommand = "runsc"

DefaultCommand is the default command for Runsc

Variables

Functions

func FormatLogPath

func FormatLogPath(id string, config map[string]string)

FormatLogPath parses runsc config, and fill in %ID% in the log path.

Types

type CreateOpts

type CreateOpts struct {
	runc.IO
	// PidFile is a path to where a pid file should be created
	PidFile       string
	ConsoleSocket runc.ConsoleSocket
	// UserLog is a path to where runsc user log should be generated.
	UserLog string
}

type DeleteOpts

type DeleteOpts struct {
	Force bool
}

type ExecOpts

type ExecOpts struct {
	runc.IO
	PidFile         string
	InternalPidFile string
	ConsoleSocket   runc.ConsoleSocket
	Detach          bool
}

type KillOpts

type KillOpts struct {
	All bool
	Pid int
}

KillOpts specifies options for killing a container and its processes

type Runsc

type Runsc struct {
	Command      string
	PdeathSignal syscall.Signal
	Setpgid      bool
	Root         string
	Log          string
	LogFormat    runc.Format
	Config       map[string]string
}

Runsc is the client to the runsc cli

func (*Runsc) Create

func (r *Runsc) Create(context context.Context, id, bundle string, opts *CreateOpts) error

Create creates a new container and returns its pid if it was created successfully

func (*Runsc) Delete

func (r *Runsc) Delete(context context.Context, id string, opts *DeleteOpts) error

Delete deletes the container

func (*Runsc) Events

func (r *Runsc) Events(context context.Context, id string, interval time.Duration) (chan *runc.Event, error)

Events returns an event stream from runsc for a container with stats and OOM notifications

func (*Runsc) Exec

func (r *Runsc) Exec(context context.Context, id string, spec specs.Process, opts *ExecOpts) error

Exec executres and additional process inside the container based on a full OCI Process specification

func (*Runsc) Kill

func (r *Runsc) Kill(context context.Context, id string, sig int, opts *KillOpts) error

Kill sends the specified signal to the container

func (*Runsc) List

func (r *Runsc) List(context context.Context) ([]*runc.Container, error)

List returns all containers created inside the provided runsc root directory

func (*Runsc) Ps

func (r *Runsc) Ps(context context.Context, id string) ([]int, error)

Ps lists all the processes inside the container returning their pids

func (*Runsc) Run

func (r *Runsc) Run(context context.Context, id, bundle string, opts *CreateOpts) (int, error)

Run runs the create, start, delete lifecycle of the container and returns its exit status after it has exited

func (*Runsc) Start

func (r *Runsc) Start(context context.Context, id string, cio runc.IO) error

Start will start an already created container

func (*Runsc) State

func (r *Runsc) State(context context.Context, id string) (*runc.Container, error)

State returns the state for the container provided by id

func (*Runsc) Stats

func (r *Runsc) Stats(context context.Context, id string) (*runc.Stats, error)

Stats return the stats for a container like cpu, memory, and io

func (*Runsc) Top

func (r *Runsc) Top(context context.Context, id string) (*runc.TopResults, error)

Top lists all the processes inside the container returning the full ps data

func (*Runsc) Wait

func (r *Runsc) Wait(context context.Context, id string) (int, error)

Wait will wait for a running container, and return its exit status. TODO(random-liu): Add exec process support.

Jump to

Keyboard shortcuts

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