rundmc

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: 19 Imported by: 0

README

RunDMC - Diminuatively Managed RunC Containers

RunDMC is a small wrapper around runC.

High Level Architecture

Each container is stored as a subdirectory of a directory called 'the depot'. The depot is the source of truth for RunDMC, when a container is created, this amounts to creating an Open Container Spec compliant container as a subdirectory of the depot directory. The subdirectory is named after the container's handle. Looking up a container amounts to checking for the presence of a subdirectory with the right name.

To execute processes in a container, we launch the runc binary inside the container directory and pass it a custom process spec. Since we want to control the container lifecycle via the API without the restriction that the container dies when its first process dies, the containers are always created with a no-op initial process that never exits. User processes are all executed using runc exec.

The process_tracker allows reattaching to running containers when RunDMC is restarted. It holds on to process input/output streams and allows reconnecting to them later.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEventStore

func NewEventStore(props Properties) *events

func NewStateStore

func NewStateStore(props Properties) *states

Types

type BundleGenerator

type BundleGenerator interface {
	Generate(spec gardener.DesiredContainerSpec) goci.Bndl
}

type BundleLoader

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

type BundleTemplate

type BundleTemplate struct {
	Rules []BundlerRule
}

func (BundleTemplate) Generate

type BundlerRule

type BundlerRule interface {
	Apply(bndle goci.Bndl, spec gardener.DesiredContainerSpec) goci.Bndl
}

type CgroupStarter

type CgroupStarter struct {
	CgroupPath    string
	CommandRunner command_runner.CommandRunner

	ProcCgroups     io.ReadCloser
	ProcSelfCgroups io.ReadCloser

	Logger lager.Logger
}

func (*CgroupStarter) Start

func (s *CgroupStarter) Start() error

type CgroupsFormatError

type CgroupsFormatError struct {
	Content string
}

func (CgroupsFormatError) Error

func (err CgroupsFormatError) Error() string

type Containerizer

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

Containerizer knows how to manage a depot of container bundles

func New

func New(depot Depot, bundler BundleGenerator, runtime OCIRuntime, loader BundleLoader, nstarRunner NstarRunner, stopper Stopper, events EventStore, states StateStore) *Containerizer

func (*Containerizer) Attach

func (c *Containerizer) Attach(log lager.Logger, handle string, processID string, io garden.ProcessIO) (garden.Process, error)

func (*Containerizer) Create

Create creates a bundle in the depot and starts its init process

func (*Containerizer) Destroy

func (c *Containerizer) Destroy(log lager.Logger, handle string) error

Destroy deletes the container and the bundle directory

func (*Containerizer) Handles

func (c *Containerizer) Handles() ([]string, error)

Handles returns a list of all container handles

func (*Containerizer) Info

func (*Containerizer) Metrics

func (*Containerizer) RemoveBundle

func (c *Containerizer) RemoveBundle(log lager.Logger, handle string) error

func (*Containerizer) Run

Run runs a process inside a running container

func (*Containerizer) Stop

func (c *Containerizer) Stop(log lager.Logger, handle string, kill bool) error

Stop stops all the processes other than the init process in the container

func (*Containerizer) StreamIn

func (c *Containerizer) StreamIn(log lager.Logger, handle string, spec garden.StreamInSpec) error

StreamIn streams files in to the container

func (*Containerizer) StreamOut

func (c *Containerizer) StreamOut(log lager.Logger, handle string, spec garden.StreamOutSpec) (io.ReadCloser, error)

StreamOut stream files from the container

type Depot

type Depot interface {
	Create(log lager.Logger, handle string, bundle depot.BundleSaver) error
	Lookup(log lager.Logger, handle string) (path string, err error)
	Destroy(log lager.Logger, handle string) error
	Handles() ([]string, error)
}

type EventStore

type EventStore interface {
	OnEvent(id string, event string) error
	Events(id string) []string
}

type NstarRunner

type NstarRunner interface {
	StreamIn(log lager.Logger, pid int, path string, user string, tarStream io.Reader) error
	StreamOut(log lager.Logger, pid int, path string, user string) (io.ReadCloser, error)
}

func NewNstarRunner

func NewNstarRunner(nstarPath, tarPath string, runner command_runner.CommandRunner) NstarRunner

type OCIRuntime

type OCIRuntime interface {
	Create(log lager.Logger, bundlePath, id string, io garden.ProcessIO) error
	Exec(log lager.Logger, id, bundlePath string, spec garden.ProcessSpec, io garden.ProcessIO) (garden.Process, error)
	Attach(log lager.Logger, id, bundlePath, processId string, io garden.ProcessIO) (garden.Process, error)
	Kill(log lager.Logger, bundlePath string) error
	Delete(log lager.Logger, bundlePath string) error
	State(log lager.Logger, id string) (runrunc.State, error)
	Stats(log lager.Logger, id string) (gardener.ActualContainerMetrics, error)
	WatchEvents(log lager.Logger, id string, eventsNotifier runrunc.EventsNotifier) error
}

type Properties

type Properties interface {
	Set(handle string, key string, value string)
	Get(handle string, key string) (string, bool)
}

type Starter

type Starter struct {
	*CgroupStarter
}

func NewStarter

func NewStarter(logger lager.Logger, procCgroupReader io.ReadCloser, procSelfCgroupReader io.ReadCloser, cgroupMountpoint string, runner command_runner.CommandRunner) *Starter

type StateStore

type StateStore interface {
	StoreStopped(handle string)
	IsStopped(handle string) bool
}

type Stopper

type Stopper interface {
	StopAll(log lager.Logger, cgroupName string, save []int, kill bool) error
}

Directories

Path Synopsis
dadoofakes
This file was generated by counterfeiter
This file was generated by counterfeiter
depotfakes
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
runruncfakes
This file was generated by counterfeiter
This file was generated by counterfeiter
stopperfakes
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