gardener

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

Documentation

Index

Constants

View Source
const BridgeIPKey = "garden.network.host-ip"
View Source
const ContainerIPKey = "garden.network.container-ip"
View Source
const ExternalIPKey = "garden.network.external-ip"
View Source
const GraceTimeKey = "garden.grace-time"
View Source
const MappedPortsKey = "garden.network.mapped-ports"
View Source
const RawRootFSScheme = "raw"

Variables

View Source
var ErrGraphDisabled = errors.New("volume graph is disabled")

Functions

func NewBulkStarter

func NewBulkStarter(starters []Starter) *bulkStarter

Types

type ActualContainerMetrics

type ActualContainerMetrics struct {
	CPU    garden.ContainerCPUStat
	Memory garden.ContainerMemoryStat
}

type ActualContainerSpec

type ActualContainerSpec struct {
	// The PID of the container's init process
	Pid int

	// The path to the container's bundle directory
	BundlePath string

	// The path to the container's rootfs
	RootFSPath string

	// Whether the container is stopped
	Stopped bool

	// Process IDs (not PIDs) of processes in the container
	ProcessIDs []string

	// Events (e.g. OOM) which have occured in the container
	Events []string

	// Applied limits
	Limits garden.Limits

	// Whether the container is privileged
	Privileged bool
}

type BulkStarter

type BulkStarter interface {
	StartAll() error
}
var NoopBulkStarter BulkStarter = NewBulkStarter([]Starter{})

type Containerizer

type Containerizer interface {
	Create(log lager.Logger, spec DesiredContainerSpec) error
	Handles() ([]string, error)

	StreamIn(log lager.Logger, handle string, spec garden.StreamInSpec) error
	StreamOut(log lager.Logger, handle string, spec garden.StreamOutSpec) (io.ReadCloser, error)

	Run(log lager.Logger, handle string, spec garden.ProcessSpec, io garden.ProcessIO) (garden.Process, error)
	Attach(log lager.Logger, handle string, processGUID string, io garden.ProcessIO) (garden.Process, error)
	Stop(log lager.Logger, handle string, kill bool) error
	Destroy(log lager.Logger, handle string) error
	RemoveBundle(log lager.Logger, handle string) error

	Info(log lager.Logger, handle string) (ActualContainerSpec, error)
	Metrics(log lager.Logger, handle string) (ActualContainerMetrics, error)
}

type DesiredContainerSpec

type DesiredContainerSpec struct {
	Handle string

	// Path to the Root Filesystem for the container
	RootFSPath string

	// Container hostname
	Hostname string

	// Bind mounts
	BindMounts []garden.BindMount

	// Container is privileged
	Privileged bool

	Limits garden.Limits

	Env []string
}

type Gardener

type Gardener struct {
	// SysInfoProvider returns total memory and total disk
	SysInfoProvider SysInfoProvider

	// Containerizer runs and manages linux containers
	Containerizer Containerizer

	// UidGenerator generates unique ids for containers
	UidGenerator UidGenerator

	// BulkStarter runs any needed Starters that do start-up tasks (e.g. setting up cgroups)
	BulkStarter BulkStarter

	// Networker creates a network for containers
	Networker Networker

	// VolumeCreator creates volumes for containers
	VolumeCreator VolumeCreator

	Logger lager.Logger

	// PropertyManager creates map of container properties
	PropertyManager PropertyManager

	// MaxContainers limits the advertised container capacity
	MaxContainers uint64

	Restorer Restorer
}

Gardener orchestrates other components to implement the Garden API

func (*Gardener) BulkInfo

func (g *Gardener) BulkInfo(handles []string) (map[string]garden.ContainerInfoEntry, error)

func (*Gardener) BulkMetrics

func (g *Gardener) BulkMetrics(handles []string) (map[string]garden.ContainerMetricsEntry, error)

func (*Gardener) Capacity

func (g *Gardener) Capacity() (garden.Capacity, error)

func (*Gardener) Containers

func (g *Gardener) Containers(props garden.Properties) ([]garden.Container, error)

func (*Gardener) Create

func (g *Gardener) Create(spec garden.ContainerSpec) (ctr garden.Container, err error)

Create creates a container by combining the results of networker.Network, volumizer.Create and containzer.Create.

func (*Gardener) Destroy

func (g *Gardener) Destroy(handle string) error

func (*Gardener) GraceTime

func (g *Gardener) GraceTime(container garden.Container) time.Duration

func (*Gardener) Lookup

func (g *Gardener) Lookup(handle string) (garden.Container, error)

func (*Gardener) Ping

func (g *Gardener) Ping() error

func (*Gardener) Start

func (g *Gardener) Start() error

func (*Gardener) Stop

func (g *Gardener) Stop()

type Networker

type Networker interface {
	Network(log lager.Logger, spec garden.ContainerSpec, pid int) error
	Capacity() uint64
	Destroy(log lager.Logger, handle string) error
	NetIn(log lager.Logger, handle string, hostPort, containerPort uint32) (uint32, uint32, error)
	BulkNetOut(log lager.Logger, handle string, rules []garden.NetOutRule) error
	NetOut(log lager.Logger, handle string, rule garden.NetOutRule) error
	Restore(log lager.Logger, handle string) error
}

type NoopRestorer

type NoopRestorer struct{}

func (*NoopRestorer) Restore

func (n *NoopRestorer) Restore(_ lager.Logger, handles []string) []string

type NoopVolumeCreator

type NoopVolumeCreator struct{}

func (NoopVolumeCreator) Create

func (NoopVolumeCreator) Destroy

func (NoopVolumeCreator) GC

func (NoopVolumeCreator) Metrics

type PropertyManager

type PropertyManager interface {
	All(handle string) (props garden.Properties, err error)
	Set(handle string, name string, value string)
	Remove(handle string, name string) error
	Get(handle string, name string) (string, bool)
	MatchesAll(handle string, props garden.Properties) bool
	DestroyKeySpace(string) error
}

type Restorer

type Restorer interface {
	Restore(logger lager.Logger, handles []string) []string
}

func NewRestorer

func NewRestorer(networker Networker) Restorer

type Starter

type Starter interface {
	Start() error
}

type SysInfoProvider

type SysInfoProvider interface {
	TotalMemory() (uint64, error)
	TotalDisk() (uint64, error)
}

type UidGenerator

type UidGenerator interface {
	Generate() string
}

type UidGeneratorFunc

type UidGeneratorFunc func() string

func (UidGeneratorFunc) Generate

func (fn UidGeneratorFunc) Generate() string

type VolumeCreator

type VolumeCreator interface {
	Create(log lager.Logger, handle string, spec rootfs_provider.Spec) (string, []string, error)
	Destroy(log lager.Logger, handle string) error
	Metrics(log lager.Logger, handle string, privileged bool) (garden.ContainerDiskStat, error)
	GC(log lager.Logger) error
}

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