runrunc

package
v0.0.0-...-7f502db Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultUID int = 0
	DefaultGID int = 0
)
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 LookupUser

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

func NewLogRunner

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

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, commandRunner command_runner.CommandRunner) *Creator

func (*Creator) Create

func (c *Creator) Create(log lager.Logger, bundlePath, id string, _ 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, handle string) error

type EventsNotifier

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

type ExecPreparer

type ExecPreparer interface {
	Prepare(log lager.Logger, bundlePath string, spec garden.ProcessSpec) (*PreparedSpec, error)
}

func NewExecPreparer

func NewExecPreparer(bundleLoader BundleLoader, userlookup UserLookupper, mkdirer Mkdirer, nonRootMaxCaps []string) ExecPreparer

type ExecRunner

type ExecRunner interface {
	Run(log lager.Logger, spec *PreparedSpec, bundlePath, processesPath, handle string, tty *garden.TTYSpec, io garden.ProcessIO) (garden.Process, error)
	Attach(log lager.Logger, processID string, io garden.ProcessIO, processesPath string) (garden.Process, error)
}

type Execer

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

func NewExecer

func NewExecer(execPreparer ExecPreparer, runner ExecRunner) *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, id 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) (*user.ExecUser, error)

func (LookupFunc) Lookup

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

type Mkdirer

type Mkdirer interface {
	MkdirAs(rootfsPath 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 command_runner.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
	HostUID int
	HostGID int
}

type Process

type Process interface {
	garden.Process
}

type ProcessTracker

type ProcessTracker interface {
	Run(processID string, cmd *exec.Cmd, io garden.ProcessIO, tty *garden.TTYSpec, pidFile string) (garden.Process, error)
	Attach(processID string, io garden.ProcessIO, pidFilePath string) (garden.Process, error)
}

type RemoveFiles

type RemoveFiles []string

func (RemoveFiles) Run

func (files RemoveFiles) Run(log lager.Logger)

type RunRunc

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

da doo

func New

func New(runner command_runner.CommandRunner, runcCmdRunner RuncCmdRunner, runc RuncBinary, dadooPath, runcPath string, execPreparer ExecPreparer, execRunner ExecRunner) *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, 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 StoppedStatus Status = "stopped"

type UidGenerator

type UidGenerator interface {
	Generate() string
}

type UserLookupper

type UserLookupper interface {
	Lookup(rootFsPath string, user string) (*user.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
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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