executor

package
v1.4.3-dev Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	// Path is the command to run
	Path string `vic:"0.1" scope:"read-only" key:"Path"`

	// Args is the command line arguments including the command in Args[0]
	Args []string `vic:"0.1" scope:"read-only" key:"Args"`

	// Env specifies the environment of the process
	Env []string `vic:"0.1" scope:"read-only" key:"Env"`

	// Dir specifies the working directory of the command
	Dir string `vic:"0.1" scope:"read-only" key:"Dir"`
}

Cmd is here because the encoding packages seem to have issues with the full exec.Cmd struct

type Common

type Common struct {
	// A reference to the components hosting execution environment, if any
	ExecutionEnvironment string

	// Unambiguous ID with meaning in the context of its hosting execution environment
	ID string `vic:"0.1" scope:"read-only" key:"id"`

	// Convenience field to record a human readable name
	Name string `vic:"0.1" scope:"read-only" key:"name"`

	// Freeform notes related to the entity
	Notes string `vic:"0.1" scope:"hidden" key:"notes"`
}

Common data between managed entities, across execution environments

type ContainerNetwork

type ContainerNetwork struct {
	// Common.Name - the symbolic name for the network, e.g. web or backend
	// Common.ID - identifier of the underlay for the network
	Common

	Type string `vic:"0.1" scope:"read-write" key:"type"`

	// Destinations is a list of CIDRs used for routing traffic to the gateway
	Destinations []net.IPNet `vic:"0.1" scope:"read-only" key:"destinations"`

	// The network scope the IP belongs to.
	// The IP address is the default gateway
	Gateway net.IPNet `vic:"0.1" scope:"read-only" key:"gateway"`

	// Should this gateway be the default route for containers on the network
	Default bool `vic:"0.1" scope:"read-only" key:"default"`

	// The set of nameservers associated with this network - may be empty
	Nameservers []net.IP `vic:"0.1" scope:"read-only" key:"dns"`

	// The IP ranges for this network
	Pools []ip.Range `vic:"0.1" scope:"read-only" key:"pools"`

	// set of network wide links and aliases for this container on this network
	Aliases []string `vic:"0.1" scope:"hidden" key:"aliases"`

	Assigned struct {
		Gateway     net.IPNet `vic:"0.1" scope:"read-write" key:"gateway"`
		Nameservers []net.IP  `vic:"0.1" scope:"read-write" key:"dns"`
	} `vic:"0.1" scope:"read-write" key:"assigned"`
}

ContainerNetwork is the data needed on a per container basis both for vSphere to ensure it's attached to the correct network, and in the guest to ensure the interface is correctly configured.

type ContainerVM

type ContainerVM struct {
	Common

	// The version of the bootstrap image that this container was booted from.
	Version string

	// Name aliases for this specific container, Maps alias to unambiguous name
	// This uses unambiguous name rather than reified network endpoint to persist
	// the intent rather than a point-in-time manifesting of that intent.
	Aliases map[string]string

	// The location of the interaction service that the tether should connect to. Examples:
	// * tcp://x.x.x.x:2377
	// * vmci://moid - should this be an moid or a VMCI CID? Does one insulate us from reboots?
	Interaction url.URL

	// Key is the host key used during communicate back with the Interaction endpoint if any
	// Used if the vSocket agent is responsible for authenticating the connection
	AgentKey []byte
}

ContainerVM holds that data tightly associated with a containerVM, but that should not be visible to the guest. This is the external complement to ExecutorConfig.

type Detail

type Detail struct {

	// creation, started & stopped timestamps
	CreateTime int64 `vic:"0.1" scope:"read-write" key:"createtime"`
	StartTime  int64 `vic:"0.1" scope:"read-write" key:"starttime"`
	StopTime   int64 `vic:"0.1" scope:"read-write" key:"stoptime"`
}

type Diagnostics

type Diagnostics struct {
	// Should debugging be enabled on whatever component this is and at what level
	DebugLevel int `vic:"0.1" scope:"read-only" key:"debug"`

	// RessurectionCount is a log of how many times the entity has been restarted due
	// to error exit
	ResurrectionCount int `vic:"0.1" scope:"read-write" key:"resurrections"`
	// ExitLogs is a best effort record of the time of process death and the cause for
	// restartable entities
	ExitLogs []ExitLog `vic:"0.1" scope:"read-write" key:"exitlogs"`
}

Diagnostics records some basic control and lifecycle information for diagnostic purposes

type ExecutorConfig

type ExecutorConfig struct {
	Common `vic:"0.1" scope:"read-only" key:"common"`

	// CreateTime stamp
	CreateTime int64 `vic:"0.1" scope:"read-write" key:"createtime"`

	// Diagnostics holds basic diagnostics data
	Diagnostics Diagnostics `vic:"0.1" scope:"read-only" key:"diagnostics"`

	// Sessions is the set of sessions currently hosted by this executor
	// These are keyed by session ID
	Sessions map[string]*SessionConfig `vic:"0.1" scope:"read-only" key:"sessions"`

	// Maps the mount name to the detail mount specification
	Mounts map[string]MountSpec `vic:"0.1" scope:"read-only" key:"mounts"`

	// This describes an executors presence on a network, and contains sufficient
	// information to configure the interface in the guest.
	Networks map[string]*NetworkEndpoint `vic:"0.1" scope:"read-only" key:"networks"`

	// Key is the host key used during communicate back with the Interaction endpoint if any
	// Used if the in-guest tether is responsible for authenticating the connection
	Key []byte `vic:"0.1" scope:"read-only" key:"key"`

	// Layer id that is backing this container VM
	LayerID string `vic:"0.1" scope:"read-only" key:"layerid"`

	// Blob metadata for the caller
	Annotations map[string]string `vic:"0.1" scope:"hidden" key:"annotations"`

	// Repository requested by user
	// TODO: a bit docker specific
	RepoName string `vic:"0.1" scope:"read-only" key:"repo"`

	// version
	Version *version.Build `vic:"0.1" scope:"read-only" key:"version"`
}

ExecutorConfig holds the data tightly associated with an Executor. This is distinct from Sessions in that there is no process inherently associated - this is closer to a ThreadPool than a Thread and is the owner of the shared filesystem environment. This is the guest visible complement to ContainerVM.

type ExitLog

type ExitLog struct {
	Time       time.Time
	ExitStatus int
	Message    string
}

ExitLog records some basic diagnostics about anomalous exit for restartable entities

type MountSpec

type MountSpec struct {
	// A URI->path mapping, e.g.
	// May contain credentials
	Source url.URL `vic:"0.1" scope:"read-only" key:"source"`

	// The path in the executor at which this should be mounted
	Path string `vic:"0.1" scope:"read-only" key:"dest"`

	// Freeform mode string, which could translate directly to mount options
	// We may want to turn this into a more structured form eventually
	Mode string `vic:"0.1" scope:"read-only" key:"mode"`
}

MountSpec details a mount that must be executed within the executor A mount is a URI -> path mapping with a credential of some kind In the case of a labeled disk:

label://<label name> => </mnt/path>

type NetworkEndpoint

type NetworkEndpoint struct {
	// Common.Name - the nic alias requested (only one name and one alias possible in linux)
	// Common.ID - pci slot of the vnic allowing for interface identifcation in-guest
	Common

	// Whether this endpoint's IP was specified by the client (true if it was)
	Static bool `vic:"0.1" scope:"read-only" key:"static"`

	// IP address to assign
	IP *net.IPNet `vic:"0.1" scope:"read-only" key:"ip"`

	// Actual IP address assigned
	Assigned net.IPNet `vic:"0.1" scope:"read-write" key:"assigned"`

	// The network in which this information should be interpreted. This is embedded directly rather than
	// as a pointer so that we can ensure the data is consistent
	Network ContainerNetwork `vic:"0.1" scope:"read-only" key:"network"`

	// The list of exposed ports on the container
	Ports []string `vic:"0.1" scope:"read-only" key:"ports"`
}

NetworkEndpoint describes a network presence in the form a vNIC in sufficient detail that it can be: a. created - the vNIC added to a VM b. identified - the guestOS can determine which interface it corresponds to c. configured - the guestOS can configure the interface correctly

type SessionConfig

type SessionConfig struct {
	// The primary session may have the same ID as the executor owning it
	Common `vic:"0.1" scope:"read-only" key:"common"`
	Detail `vic:"0.1" scope:"read-write" key:"detail"`

	// The primary process for the session
	Cmd Cmd `vic:"0.1" scope:"read-only" key:"cmd"`

	// Allow attach
	Attach bool `vic:"0.1" scope:"read-only" key:"attach"`

	OpenStdin bool `vic:"0.1" scope:"read-only" key:"openstdin"`

	// Delay launching the Cmd until an attach request comes
	RunBlock bool `vic:"0.1" scope:"read-only" key:"runblock"`

	// Allocate a tty or not
	Tty bool `vic:"0.1" scope:"read-only" key:"tty"`

	ExitStatus int `vic:"0.1" scope:"read-write" key:"status"`

	Started string `vic:"0.1" scope:"read-write" key:"started"`

	Restart bool `vic:"0.1" scope:"read-only" key:"restart"`

	// StopSignal is the signal name or number used to stop container session
	StopSignal string `vic:"0.1" scope:"read-only" key:"stopSignal"`

	// Diagnostics holds basic diagnostics data
	Diagnostics Diagnostics `vic:"0.1" scope:"read-only" key:"diagnostics"`

	// User and group for setuid programs.
	// Need to go here since UID/GID resolution must be done on appliance
	User  string `vic:"0.1" scope:"read-only" key:"User"`
	Group string `vic:"0.1" scope:"read-only" key:"Group"`
}

SessionConfig defines the content of a session - this maps to the root of a process tree inside an executor This is close to but not perfectly aligned with the new docker/docker/daemon/execdriver/driver:CommonProcessConfig

type State

type State int
const (
	STARTED State = iota
	EXITED
	KILLED
)

Jump to

Keyboard shortcuts

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