docker

package
v0.0.0-...-a204096 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DockerStatusRunning = iota
	DockerStatusPaused
	DockerStatusRestarting
	DockerStatusKilled
	DockerStatusUnknown

	ProviderName   = "docker"
	TimeoutSeconds = 5
)

Variables

View Source
var (
	// bson fields for the Settings struct
	HostIp     = bsonutil.MustHaveTag(Settings{}, "HostIp")
	BindIp     = bsonutil.MustHaveTag(Settings{}, "BindIp")
	ImageId    = bsonutil.MustHaveTag(Settings{}, "ImageId")
	ClientPort = bsonutil.MustHaveTag(Settings{}, "ClientPort")
	PortRange  = bsonutil.MustHaveTag(Settings{}, "PortRange")
	Auth       = bsonutil.MustHaveTag(Settings{}, "Auth")

	// bson fields for the portRange struct
	MinPort = bsonutil.MustHaveTag(portRange{}, "MinPort")
	MaxPort = bsonutil.MustHaveTag(portRange{}, "MaxPort")

	// bson fields for the auth struct
	Cert = bsonutil.MustHaveTag(auth{}, "Cert")
	Key  = bsonutil.MustHaveTag(auth{}, "Key")
	Ca   = bsonutil.MustHaveTag(auth{}, "Ca")

	// exposed port (set to 22/tcp, default ssh port)
	SSHDPort docker.Port = "22/tcp"
)

Functions

This section is empty.

Types

type DockerManager

type DockerManager struct {
}

func (*DockerManager) CanSpawn

func (dockerMgr *DockerManager) CanSpawn() (bool, error)

CanSpawn returns if a given cloud provider supports spawning a new host dynamically. Always returns true for Docker.

func (*DockerManager) Configure

func (dockerMgr *DockerManager) Configure(settings *evergreen.Settings) error

Configure populates a DockerManager by reading relevant settings from the config object.

func (*DockerManager) GetDNSName

func (dockerMgr *DockerManager) GetDNSName(host *host.Host) (string, error)

GetDNSName gets the DNS hostname of a container by reading it directly from the Docker API

func (*DockerManager) GetInstanceStatus

func (dockerMgr *DockerManager) GetInstanceStatus(host *host.Host) (cloud.CloudStatus, error)

GetInstanceStatus returns a universal status code representing the state of a container.

func (*DockerManager) GetSSHOptions

func (dockerMgr *DockerManager) GetSSHOptions(host *host.Host, keyPath string) ([]string, error)

GetSSHOptions returns an array of default SSH options for connecting to a container.

func (*DockerManager) GetSettings

func (_ *DockerManager) GetSettings() cloud.ProviderSettings

func (*DockerManager) IsSSHReachable

func (dockerMgr *DockerManager) IsSSHReachable(host *host.Host, keyPath string) (bool, error)

IsSSHReachable checks if a container appears to be reachable via SSH by attempting to contact the host directly.

func (*DockerManager) IsUp

func (dockerMgr *DockerManager) IsUp(host *host.Host) (bool, error)

IsUp checks the container's state by querying the Docker API and returns true if the host should be available to connect with SSH.

func (*DockerManager) OnUp

func (dockerMgr *DockerManager) OnUp(host *host.Host) error

func (*DockerManager) SpawnInstance

func (dockerMgr *DockerManager) SpawnInstance(d *distro.Distro, hostOpts cloud.HostOptions) (*host.Host, error)

SpawnInstance creates and starts a new Docker container

func (*DockerManager) TerminateInstance

func (dockerMgr *DockerManager) TerminateInstance(host *host.Host) error

TerminateInstance destroys a container.

func (*DockerManager) TimeTilNextPayment

func (dockerMgr *DockerManager) TimeTilNextPayment(host *host.Host) time.Duration

TimeTilNextPayment returns the amount of time until the next payment is due for the host. For Docker this is not relevant.

type Settings

type Settings struct {
	HostIp     string     `mapstructure:"host_ip" json:"host_ip" bson:"host_ip"`
	BindIp     string     `mapstructure:"bind_ip" json:"bind_ip" bson:"bind_ip"`
	ImageId    string     `mapstructure:"image_name" json:"image_name" bson:"image_name"`
	ClientPort int        `mapstructure:"client_port" json:"client_port" bson:"client_port"`
	PortRange  *portRange `mapstructure:"port_range" json:"port_range" bson:"port_range"`
	Auth       *auth      `mapstructure:"auth" json:"auth" bson:"auth"`
}

func (*Settings) Validate

func (settings *Settings) Validate() error

Validate checks that the settings from the config file are sane.

Jump to

Keyboard shortcuts

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