deployment

package
v0.0.0-...-5f4265e Latest Latest
Warning

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

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

Documentation

Overview

Classes that define relationships between containers (links) and simple strategies for placement.

Provides gear deployment and linking from a deployment descriptor.

Index

Constants

View Source
const DistributeAffinity = "distribute"

Variables

This section is empty.

Functions

func NewHttpClient

func NewHttpClient(insecure bool, timeout time.Duration) *http.Client

Create new Http Client for use by deployment library

Types

type Container

type Container struct {
	Name        string
	Image       string
	PublicPorts port.PortPairs                  `json:"PublicPorts,omitempty"`
	Links       Links                           `json:"Links,omitempty"`
	Environment containers.EnvironmentVariables `json:",omitempty"`

	Count    int
	Affinity string `json:"Affinity,omitempty"`
	// contains filtered or unexported fields
}

A container description

func (*Container) AddInstance

func (c *Container) AddInstance(instance *Instance)

func (*Container) Instances

func (c *Container) Instances() InstanceRefs

type Containers

type Containers []Container

func (Containers) Copy

func (c Containers) Copy() (dup Containers)

func (Containers) Find

func (c Containers) Find(name string) (*Container, bool)
func (sources Containers) OrderLinks() (ordered containerLinks, err error)

Return the set of links that should be resolved

type Deployment

type Deployment struct {
	Containers Containers
	Instances  Instances

	IdPrefix     string
	RandomizeIds bool
}

A description of a deployment

func NewDeploymentFromFile

func NewDeploymentFromFile(path string) (*Deployment, error)

func NewDeploymentFromURL

func NewDeploymentFromURL(uri string, insecure bool, timeout time.Duration) (*Deployment, error)

func (Deployment) Describe

func (d Deployment) Describe(placement PlacementStrategy, t transport.Transport) (next *Deployment, removed InstanceRefs, err error)
func (d *Deployment) UpdateLinks()

Invoke to update instance links to the correct external ports.

type Instance

type Instance struct {
	// The id of this instance
	Id containers.Identifier
	// The image used by this instance
	Image string
	// The container definition this is from
	From string
	// The deployed location - nil for not deployed
	On *string `json:"On,omitempty"`
	// The mapping of internal, external, and remote ports
	Ports PortMappings `json:"Ports,omitempty"`

	// Extra environment variables set for the instance
	Environment containers.EnvironmentVariables `json:",omitempty"`
	// contains filtered or unexported fields
}

A container that has been created on a server

func (*Instance) Added

func (i *Instance) Added() bool

func (*Instance) EnvironmentVariables

func (i *Instance) EnvironmentVariables() *containers.EnvironmentDescription

func (*Instance) MarkRemoved

func (i *Instance) MarkRemoved()
func (i *Instance) NetworkLinks() containers.NetworkLinks

func (*Instance) Place

func (i *Instance) Place(on transport.Locator)

func (*Instance) ResolveHostname

func (i *Instance) ResolveHostname() (string, error)
type InstanceLink struct {
	containers.NetworkLink
	// contains filtered or unexported fields
}

A materialized link between two instances

type InstanceLinks []InstanceLink
func (links InstanceLinks) NetworkLinks() (dup containers.NetworkLinks)

type InstancePortTable

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

func NewInstancePortTable

func NewInstancePortTable(sources Containers) (*InstancePortTable, error)

func (*InstancePortTable) Reserve

func (p *InstancePortTable) Reserve(loopback, same bool, from port.Port) port.HostPort

type InstanceRefs

type InstanceRefs []*Instance

type Instances

type Instances []Instance

func (Instances) Added

func (refs Instances) Added() InstanceRefs

func (Instances) Find

func (instances Instances) Find(id containers.Identifier) (*Instance, bool)

func (Instances) Linked

func (refs Instances) Linked() InstanceRefs

func (Instances) References

func (instances Instances) References() InstanceRefs

func (Instances) ReferencesFor

func (instances Instances) ReferencesFor(name string) InstanceRefs
type Link struct {
	To string

	NonLocal  bool `json:"NonLocal,omitempty"`
	MatchPort bool `json:"MatchPort,omitempty"`

	Ports      port.Ports     `json:"Ports,omitempty"`
	AliasPorts port.PortPairs `json:"AliasPorts,omitempty"`
	// contains filtered or unexported fields
}

A relationship between two containers

type Links []Link

type PlacementStrategy

type PlacementStrategy interface {
	// Return true if the location of an existing container is no
	// longer valid.
	RemoveFromLocation(locator transport.Locator) bool
	// Allow the strategy to determine which location will host a
	// container by setting Instance.On for each container in added.
	// Failing to set an "On" for a container will return an error.
	//
	// Placement strategies may optionally suggest containers to remove
	// when scaling down by invoking Instance.MarkRemoved(). The caller
	// will then use those suggestions when determining the containers
	// to purge.
	Assign(added InstanceRefs, containers Containers) error
}

type PortAssignmentStrategy

type PortAssignmentStrategy interface {
	Reserve(loopback, same bool, from port.Port) port.HostPort
}

type PortMapping

type PortMapping struct {
	port.PortPair
	Target port.HostPort
}

A port on a container instance that is linked elsewhere

type PortMappings

type PortMappings []PortMapping

func (PortMappings) Find

func (p PortMappings) Find(port port.Port) (*PortMapping, bool)

func (PortMappings) FindTarget

func (p PortMappings) FindTarget(target port.HostPort) (*PortMapping, bool)

func (PortMappings) PortPairs

func (ports PortMappings) PortPairs() (dup port.PortPairs)

func (PortMappings) Update

func (ports PortMappings) Update(changed port.PortPairs) bool

type SimplePlacement

type SimplePlacement transport.Locators

func (SimplePlacement) Assign

func (p SimplePlacement) Assign(added InstanceRefs, containers Containers) error

func (SimplePlacement) RemoveFromLocation

func (p SimplePlacement) RemoveFromLocation(on transport.Locator) bool

Jump to

Keyboard shortcuts

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