runrunc

package
v0.0.0-...-42bfd3d Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 23 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogRunner

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

Types

type BundleLoader

type BundleLoader interface {
	Load(log lager.Logger, handle string) (goci.Bndl, error)
}

type BundleManager

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

func NewBundleManager

func NewBundleManager(depot Depot, processDepot ProcessDepot) *BundleManager

func (*BundleManager) BundleInfo

func (i *BundleManager) BundleInfo(log lager.Logger, handle string) (string, goci.Bndl, error)

func (*BundleManager) ContainerHandles

func (i *BundleManager) ContainerHandles() ([]string, error)

func (*BundleManager) ContainerPeaHandles

func (i *BundleManager) ContainerPeaHandles(log lager.Logger, sandboxHandle string) ([]string, error)

func (*BundleManager) RemoveBundle

func (i *BundleManager) RemoveBundle(log lager.Logger, handle string) error

type Creator

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

func NewCreator

func NewCreator(
	runc RuncBinary,
	runcExtraArgs []string,
	commandRunner commandrunner.CommandRunner,
	eventsWatcher EventsWatcher,
	depot Depot,
) *Creator

func (*Creator) Create

func (c *Creator) Create(log lager.Logger, id string, bundle goci.Bndl, pio garden.ProcessIO) error

type Depot

type Depot interface {
	Create(log lager.Logger, handle string, bundle goci.Bndl) (string, error)
	CreatedTime(log lager.Logger, handle string) (time.Time, error)
	Lookup(log lager.Logger, handle string) (path string, err error)
	Load(log lager.Logger, handle string) (bundle goci.Bndl, err error)
	Handles() ([]string, error)
	Destroy(log lager.Logger, handle string) error
}

type EventsWatcher

type EventsWatcher interface {
	WatchEvents(log lager.Logger, handle string) error
}

type ExecRunner

type ExecRunner interface {
	Run(
		log lager.Logger, processID, sandboxHandle string,
		pio garden.ProcessIO, tty bool, procJSON io.Reader, extraCleanup func() error,
	) (garden.Process, error)
	RunPea(
		log lager.Logger, processID string, bundle goci.Bndl, sandboxHandle string,
		pio garden.ProcessIO, tty bool, procJSON io.Reader, extraCleanup func() error,
	) (garden.Process, error)
	Attach(log lager.Logger, sandboxHandle, processID string, io garden.ProcessIO) (garden.Process, error)
}

type Execer

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

func NewExecer

func NewExecer(bundleLoader BundleLoader, processBuilder ProcessBuilder, mkdirer Mkdirer, userLookupper users.UserLookupper, execRunner ExecRunner, pidGetter PidGetter) *Execer

func (*Execer) Attach

func (e *Execer) Attach(log lager.Logger, 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, sandboxHandle string, spec garden.ProcessSpec, io garden.ProcessIO) (garden.Process, error)

Exec a process in a bundle using 'runc exec'

func (*Execer) ExecWithBndl

func (e *Execer) ExecWithBndl(log lager.Logger, sandboxHandle string, bundle goci.Bndl, spec garden.ProcessSpec, io garden.ProcessIO) (garden.Process, error)

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 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) Events

func (r *OomWatcher) Events(log lager.Logger) (<-chan event.Event, error)

func (*OomWatcher) WatchEvents

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

type PidGetter

type PidGetter interface {
	GetPid(log lager.Logger, containerHandle string) (int, error)
}

type ProcessBuilder

type ProcessBuilder interface {
	BuildProcess(bndl goci.Bndl, processSpec garden.ProcessSpec, user *users.ExecUser) *specs.Process
}

type ProcessDepot

type ProcessDepot interface {
	ListProcessDirs(log lager.Logger, sandboxHandle string) ([]string, error)
	CreatedTime(log lager.Logger, processID string) (time.Time, error)
}

type RunRunc

da doo

func New

func New(
	creator *Creator,
	execer *Execer,
	oomWatcher *OomWatcher,
	statser *Statser,
	stater *Stater,
	deleter *deleter.Deleter,
	bundleManager *BundleManager,
) *RunRunc

type RuncBinary

type RuncBinary interface {
	RunCommand(bundlePath, pidfilePath, logfilePath, id string, extraGlobalArgs []string) *exec.Cmd
	ExecCommand(id, processJSONPath, pidFilePath string) *exec.Cmd
	EventsCommand(id string) *exec.Cmd
	StateCommand(id, logFile string) *exec.Cmd
	StatsCommand(id, 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 RuncDeleter

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

func NewDeleter

func NewDeleter(runner RuncCmdRunner, runc RuncBinary) *RuncDeleter

func (*RuncDeleter) Delete

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

type Runner

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

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 rundmc.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, depot Depot, processDepot ProcessDepot) *Statser

func (*Statser) Stats

func (r *Statser) Stats(log lager.Logger, id string) (gardener.StatsContainerMetrics, error)

type UidGenerator

type UidGenerator interface {
	Generate() string
}

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
pid
pidfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
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