runrunc

package
v0.0.0-...-cf22b21 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUID  int    = 0
	DefaultGID  int    = 0
	DefaultHome string = "/root"
)
View Source
const DefaultPath = "PATH=/usr/local/bin:/usr/bin:/bin"
View Source
const DefaultRootPath = "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

Variables

This section is empty.

Functions

func NewLogRunner

func NewLogRunner(runner commandrunner.CommandRunner, logFileGenerator generateLogFileFunc) *logRunner

func UnixEnvFor

func UnixEnvFor(bndl goci.Bndl, spec ProcessSpec) []string

func WindowsEnvFor

func WindowsEnvFor(bndl goci.Bndl, spec ProcessSpec) []string

Types

type BundleLoader

type BundleLoader interface {
	Load(path string) (goci.Bndl, error)
}

type Creator

type Creator struct {
	// contains filtered or unexported fields
}

func NewCreator

func NewCreator(runcPath string, runcExtraArgs []string, commandRunner commandrunner.CommandRunner) *Creator

func (*Creator) Create

func (c *Creator) Create(log lager.Logger, bundlePath, id string, pio garden.ProcessIO) (theErr error)

type Deleter

type Deleter struct {
	// contains filtered or unexported fields
}

func NewDeleter

func NewDeleter(runner RuncCmdRunner, runc RuncBinary) *Deleter

func (*Deleter) Delete

func (d *Deleter) Delete(log lager.Logger, force bool, handle string) error

type EnvDeterminer

type EnvDeterminer interface {
	EnvFor(bndl goci.Bndl, spec ProcessSpec) []string
}

type EnvFunc

type EnvFunc func(bndl goci.Bndl, spec ProcessSpec) []string

func (EnvFunc) EnvFor

func (fn EnvFunc) EnvFor(bndl goci.Bndl, spec ProcessSpec) []string

type EventsNotifier

type EventsNotifier interface {
	OnEvent(handle string, event string) error
}

type ExecRunner

type ExecRunner interface {
	Run(
		log lager.Logger, processID, processPath, sandboxHandle, sandboxBundlePath string,
		containerRootHostUID, containerRootHostGID uint32, pio garden.ProcessIO, tty bool,
		procJSON io.Reader, extraCleanup func() error,
	) (garden.Process, error)
	Attach(log lager.Logger, processID string, io garden.ProcessIO, processesPath string) (garden.Process, error)
}

type ExecUser

type ExecUser struct {
	Uid   int
	Gid   int
	Sgids []int
	Home  string
}

func LookupUser

func LookupUser(rootFsPath, userName string) (*ExecUser, error)

type Execer

type Execer struct {
	// contains filtered or unexported fields
}

func NewExecer

func NewExecer(bundleLoader BundleLoader, processBuilder ProcessBuilder, mkdirer Mkdirer, userLookuper UserLookupper, runner ExecRunner, processIDGen UidGenerator) *Execer

func (*Execer) Attach

func (e *Execer) Attach(log lager.Logger, bundlePath, id, processID string, io garden.ProcessIO) (garden.Process, error)

Attach attaches to an already running process by guid

func (*Execer) Exec

func (e *Execer) Exec(log lager.Logger, bundlePath, sandboxHandle string, spec garden.ProcessSpec, io garden.ProcessIO) (garden.Process, error)

Exec a process in a bundle using 'runc exec'

type Killer

type Killer struct {
	// contains filtered or unexported fields
}

func NewKiller

func NewKiller(runner RuncCmdRunner, runc RuncBinary) *Killer

func (*Killer) Kill

func (r *Killer) Kill(log lager.Logger, handle string) error

Kill a bundle using 'runc kill'

type LogDir

type LogDir string

func (LogDir) GenerateLogFile

func (dir LogDir) GenerateLogFile() (*os.File, error)

type LoggingCmd

type LoggingCmd func(logFile string) *exec.Cmd

type LookupFunc

type LookupFunc func(rootfsPath, user string) (*ExecUser, error)

func (LookupFunc) Lookup

func (fn LookupFunc) Lookup(rootfsPath, user string) (*ExecUser, error)

type Mkdirer

type Mkdirer interface {
	MkdirAs(rootFSPathFile string, uid, gid int, mode os.FileMode, recreate bool, path ...string) error
}

type OomWatcher

type OomWatcher struct {
	// contains filtered or unexported fields
}

func NewOomWatcher

func NewOomWatcher(runner commandrunner.CommandRunner, runc RuncBinary) *OomWatcher

func (*OomWatcher) WatchEvents

func (r *OomWatcher) WatchEvents(log lager.Logger, handle string, eventsNotifier EventsNotifier) error

type PreparedSpec

type PreparedSpec struct {
	specs.Process
	ContainerRootHostUID uint32
	ContainerRootHostGID uint32
}

type ProcBuilder

type ProcBuilder struct {
	// contains filtered or unexported fields
}

func NewProcessBuilder

func NewProcessBuilder(envDeterminer EnvDeterminer, nonRootMaxCaps []string) *ProcBuilder

func (*ProcBuilder) BuildProcess

func (p *ProcBuilder) BuildProcess(bndl goci.Bndl, spec ProcessSpec) *PreparedSpec

type ProcessBuilder

type ProcessBuilder interface {
	BuildProcess(bndl goci.Bndl, processSpec ProcessSpec) *PreparedSpec
}

type ProcessSpec

type ProcessSpec struct {
	garden.ProcessSpec
	ContainerUID int
	ContainerGID int
}

type RunRunc

type RunRunc struct {
	*Execer
	*Creator
	*OomWatcher
	*Statser
	*Stater
	*Killer
	*Deleter
	// contains filtered or unexported fields
}

da doo

func New

func New(
	runner commandrunner.CommandRunner, runcCmdRunner RuncCmdRunner,
	runc RuncBinary, dadooPath, runcPath string, runcExtraArgs []string, bundleLoader BundleLoader, processBuilder ProcessBuilder,
	mkdirer Mkdirer, userLookuper UserLookupper, execRunner ExecRunner, uidGenerator UidGenerator,
) *RunRunc

type RuncBinary

type RuncBinary interface {
	ExecCommand(id, processJSONPath, pidFilePath string) *exec.Cmd
	EventsCommand(id string) *exec.Cmd
	StateCommand(id, logFile string) *exec.Cmd
	StatsCommand(id, logFile string) *exec.Cmd
	KillCommand(id, signal, logFile string) *exec.Cmd
	DeleteCommand(id string, force bool, logFile string) *exec.Cmd
}

type RuncCmdRunner

type RuncCmdRunner interface {
	RunAndLog(log lager.Logger, cmd LoggingCmd) error
}

type Runner

type Runner interface {
	Run(log lager.Logger)
}

type State

type State struct {
	Pid    int
	Status Status
}

type Stater

type Stater struct {
	// contains filtered or unexported fields
}

func NewStater

func NewStater(runner RuncCmdRunner, runc RuncBinary) *Stater

func (*Stater) State

func (r *Stater) State(log lager.Logger, handle string) (state State, err error)

State gets the state of the bundle

type StatsNotifier

type StatsNotifier interface {
	OnStat(handle string, cpuStat garden.ContainerCPUStat, memoryStat garden.ContainerMemoryStat)
}

type Statser

type Statser struct {
	// contains filtered or unexported fields
}

func NewStatser

func NewStatser(runner RuncCmdRunner, runc RuncBinary) *Statser

func (*Statser) Stats

type Status

type Status string
const CreatedStatus Status = "created"
const RunningStatus Status = "running"
const StoppedStatus Status = "stopped"

type UidGenerator

type UidGenerator interface {
	Generate() string
}

type UserLookupper

type UserLookupper interface {
	Lookup(rootFsPath string, user string) (*ExecUser, error)
}

type WaitWatcher

type WaitWatcher interface {
	OnExit(log lager.Logger, process Waiter, onExit Runner)
}

type Waiter

type Waiter interface {
	Wait() (int, error)
}

type Watcher

type Watcher struct{}

func (Watcher) OnExit

func (w Watcher) OnExit(log lager.Logger, process Waiter, onExit Runner)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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