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 ¶
- func IsMountPoint(path string) (bool, error)
- func NewEventStore(props Properties) *events
- func NewStateStore(props Properties) *states
- type BundleGenerator
- type BundleTemplate
- type BundlerRule
- type CPUCgrouper
- type Containerizer
- func (c *Containerizer) Attach(log lager.Logger, handle string, processID string, io garden.ProcessIO) (garden.Process, error)
- func (c *Containerizer) Create(log lager.Logger, spec spec.DesiredContainerSpec) error
- func (c *Containerizer) Destroy(log lager.Logger, handle string) error
- func (c *Containerizer) Handles() ([]string, error)
- func (c *Containerizer) Info(log lager.Logger, handle string) (spec.ActualContainerSpec, error)
- func (c *Containerizer) Metrics(log lager.Logger, handle string) (gardener.ActualContainerMetrics, error)
- func (c *Containerizer) RemoveBundle(log lager.Logger, handle string) error
- func (c *Containerizer) Run(log lager.Logger, handle string, spec garden.ProcessSpec, io garden.ProcessIO) (garden.Process, error)
- func (c *Containerizer) Shutdown() error
- func (c *Containerizer) Stop(log lager.Logger, handle string, kill bool) error
- func (c *Containerizer) StreamIn(log lager.Logger, handle string, spec garden.StreamInSpec) error
- func (c *Containerizer) StreamOut(log lager.Logger, handle string, spec garden.StreamOutSpec) (io.ReadCloser, error)
- func (c *Containerizer) WatchRuntimeEvents(log lager.Logger) error
- type Depot
- type EventStore
- type MountOptionsGetter
- type MountPointChecker
- type NstarRunner
- type OCIRuntime
- type PeaCreator
- type PeaUsernameResolver
- type ProcessesStopper
- type Properties
- type RuntimeStopper
- type State
- type StateStore
- type Status
Constants ¶
Variables ¶
Functions ¶
func IsMountPoint ¶
func NewEventStore ¶
func NewEventStore(props Properties) *events
func NewStateStore ¶
func NewStateStore(props Properties) *states
Types ¶
type BundleGenerator ¶
type BundleGenerator interface {
Generate(desiredContainerSpec spec.DesiredContainerSpec) (goci.Bndl, error)
}
type BundleTemplate ¶
type BundleTemplate struct {
Rules []BundlerRule
}
func (BundleTemplate) Generate ¶
func (b BundleTemplate) Generate(spec spec.DesiredContainerSpec) (goci.Bndl, error)
type BundlerRule ¶
type CPUCgrouper ¶
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, nstarRunner NstarRunner, processesStopper ProcessesStopper, events EventStore, states StateStore, peaCreator PeaCreator, peaUsernameResolver PeaUsernameResolver, cpuEntitlementPerShare float64, runtimeStopper RuntimeStopper, cpuCgrouper CPUCgrouper, ) *Containerizer
func (*Containerizer) Create ¶
func (c *Containerizer) Create(log lager.Logger, spec spec.DesiredContainerSpec) error
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)
func (*Containerizer) Info ¶
func (c *Containerizer) Info(log lager.Logger, handle string) (spec.ActualContainerSpec, error)
func (*Containerizer) Metrics ¶
func (c *Containerizer) Metrics(log lager.Logger, handle string) (gardener.ActualContainerMetrics, error)
func (*Containerizer) RemoveBundle ¶
func (c *Containerizer) RemoveBundle(log lager.Logger, handle string) error
func (*Containerizer) Run ¶
func (c *Containerizer) Run(log lager.Logger, handle string, spec garden.ProcessSpec, io garden.ProcessIO) (garden.Process, error)
Run runs a process inside a running container
func (*Containerizer) Shutdown ¶
func (c *Containerizer) Shutdown() error
func (*Containerizer) Stop ¶
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
func (*Containerizer) WatchRuntimeEvents ¶
func (c *Containerizer) WatchRuntimeEvents(log lager.Logger) error
type EventStore ¶
type MountOptionsGetter ¶
type MountPointChecker ¶
func (MountPointChecker) IsMountPoint ¶
func (c MountPointChecker) IsMountPoint(path string) (bool, error)
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 commandrunner.CommandRunner) NstarRunner
type OCIRuntime ¶
type OCIRuntime interface { Create(log lager.Logger, id string, bundle goci.Bndl, io garden.ProcessIO) error Exec(log lager.Logger, id string, spec garden.ProcessSpec, io garden.ProcessIO) (garden.Process, error) Attach(log lager.Logger, id, processId string, io garden.ProcessIO) (garden.Process, error) Delete(log lager.Logger, id string) error State(log lager.Logger, id string) (State, error) Stats(log lager.Logger, id string) (gardener.StatsContainerMetrics, error) Events(log lager.Logger) (<-chan event.Event, error) ContainerHandles() ([]string, error) ContainerPeaHandles(log lager.Logger, id string) ([]string, error) BundleInfo(log lager.Logger, id string) (string, goci.Bndl, error) RemoveBundle(log lager.Logger, id string) error }
type PeaCreator ¶
type PeaUsernameResolver ¶
type ProcessesStopper ¶
type Properties ¶
type RuntimeStopper ¶
type RuntimeStopper interface {
Stop() error
}
type StateStore ¶
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
bundlerulesfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
fs/fsfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
deleterfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
depotfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
execrunnerfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
peasfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
privchecker/privcheckerfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
processwaiter/processwaiterfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
processesfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
privchecker/privcheckerfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
runcontainerdfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
pid/pidfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
runruncfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
signalsfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
stopperfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
usersfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |