swarm

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// UpdateFailureActionPause PAUSE
	UpdateFailureActionPause = "pause"
	// UpdateFailureActionContinue CONTINUE
	UpdateFailureActionContinue = "continue"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotations

type Annotations struct {
	Name   string            `json:",omitempty"`
	Labels map[string]string `json:",omitempty"`
}

Annotations represents how to describe an object.

type BindOptions

type BindOptions struct {
	Propagation MountPropagation `json:",omitempty"`
}

BindOptions defines options specific to mounts of type "bind".

type CAConfig

type CAConfig struct {
	NodeCertExpiry time.Duration `json:",omitempty"`
	ExternalCAs    []*ExternalCA `json:",omitempty"`
}

CAConfig represents CA configuration.

type ClusterInfo

type ClusterInfo struct {
	ID string
	Meta
	Spec Spec
}

ClusterInfo represents info about a the cluster for outputing in "info" it contains the same information as "Swarm", but without the JoinTokens

type ContainerSpec

type ContainerSpec struct {
	Image           string            `json:",omitempty"`
	Labels          map[string]string `json:",omitempty"`
	Command         []string          `json:",omitempty"`
	Args            []string          `json:",omitempty"`
	Env             []string          `json:",omitempty"`
	Dir             string            `json:",omitempty"`
	User            string            `json:",omitempty"`
	Mounts          []Mount           `json:",omitempty"`
	StopGracePeriod *time.Duration    `json:",omitempty"`
}

ContainerSpec represents the spec of a container.

type ContainerStatus

type ContainerStatus struct {
	ContainerID string `json:",omitempty"`
	PID         int    `json:",omitempty"`
	ExitCode    int    `json:",omitempty"`
}

ContainerStatus represents the status of a container.

type DispatcherConfig

type DispatcherConfig struct {
	HeartbeatPeriod uint64 `json:",omitempty"`
}

DispatcherConfig represents dispatcher configuration.

type Driver

type Driver struct {
	Name    string            `json:",omitempty"`
	Options map[string]string `json:",omitempty"`
}

Driver represents a driver (network/volume).

type Endpoint

type Endpoint struct {
	Spec       EndpointSpec        `json:",omitempty"`
	Ports      []PortConfig        `json:",omitempty"`
	VirtualIPs []EndpointVirtualIP `json:",omitempty"`
}

Endpoint represents an endpoint.

type EndpointSpec

type EndpointSpec struct {
	Mode  ResolutionMode `json:",omitempty"`
	Ports []PortConfig   `json:",omitempty"`
}

EndpointSpec represents the spec of an endpoint.

type EndpointVirtualIP

type EndpointVirtualIP struct {
	NetworkID string `json:",omitempty"`
	Addr      string `json:",omitempty"`
}

EndpointVirtualIP represents the virtual ip of a port.

type EngineDescription

type EngineDescription struct {
	EngineVersion string              `json:",omitempty"`
	Labels        map[string]string   `json:",omitempty"`
	Plugins       []PluginDescription `json:",omitempty"`
}

EngineDescription represents the description of an engine.

type ExternalCA

type ExternalCA struct {
	Protocol ExternalCAProtocol
	URL      string
	Options  map[string]string `json:",omitempty"`
}

ExternalCA defines external CA to be used by the cluster.

type ExternalCAProtocol

type ExternalCAProtocol string

ExternalCAProtocol represents type of external CA.

const ExternalCAProtocolCFSSL ExternalCAProtocol = "cfssl"

ExternalCAProtocolCFSSL CFSSL

type GlobalService

type GlobalService struct{}

GlobalService is a kind of ServiceMode.

type IPAMConfig

type IPAMConfig struct {
	Subnet  string `json:",omitempty"`
	Range   string `json:",omitempty"`
	Gateway string `json:",omitempty"`
}

IPAMConfig represents ipam configuration.

type IPAMOptions

type IPAMOptions struct {
	Driver  Driver       `json:",omitempty"`
	Configs []IPAMConfig `json:",omitempty"`
}

IPAMOptions represents ipam options.

type Info

type Info struct {
	NodeID   string
	NodeAddr string

	LocalNodeState   LocalNodeState
	ControlAvailable bool
	Error            string

	RemoteManagers []Peer
	Nodes          int
	Managers       int

	Cluster ClusterInfo
}

Info represents generic information about swarm.

type InitRequest

type InitRequest struct {
	ListenAddr      string
	AdvertiseAddr   string
	ForceNewCluster bool
	Spec            Spec
}

InitRequest is the request used to init a swarm.

type JoinRequest

type JoinRequest struct {
	ListenAddr    string
	AdvertiseAddr string
	RemoteAddrs   []string
	JoinToken     string // accept by secret
}

JoinRequest is the request used to join a swarm.

type JoinTokens

type JoinTokens struct {
	Worker  string
	Manager string
}

JoinTokens contains the tokens workers and managers need to join the swarm.

type LocalNodeState

type LocalNodeState string

LocalNodeState represents the state of the local node.

const (
	// LocalNodeStateInactive INACTIVE
	LocalNodeStateInactive LocalNodeState = "inactive"
	// LocalNodeStatePending PENDING
	LocalNodeStatePending LocalNodeState = "pending"
	// LocalNodeStateActive ACTIVE
	LocalNodeStateActive LocalNodeState = "active"
	// LocalNodeStateError ERROR
	LocalNodeStateError LocalNodeState = "error"
)

type ManagerStatus

type ManagerStatus struct {
	Leader       bool         `json:",omitempty"`
	Reachability Reachability `json:",omitempty"`
	Addr         string       `json:",omitempty"`
}

ManagerStatus represents the status of a manager.

type Meta

type Meta struct {
	Version   Version   `json:",omitempty"`
	CreatedAt time.Time `json:",omitempty"`
	UpdatedAt time.Time `json:",omitempty"`
}

Meta is base object inherited by most of the other once.

type Mount

type Mount struct {
	Type     MountType `json:",omitempty"`
	Source   string    `json:",omitempty"`
	Target   string    `json:",omitempty"`
	ReadOnly bool      `json:",omitempty"`

	BindOptions   *BindOptions   `json:",omitempty"`
	VolumeOptions *VolumeOptions `json:",omitempty"`
}

Mount represents a mount (volume).

type MountPropagation

type MountPropagation string

MountPropagation represents the propagation of a mount.

const (
	// MountPropagationRPrivate RPRIVATE
	MountPropagationRPrivate MountPropagation = "rprivate"
	// MountPropagationPrivate PRIVATE
	MountPropagationPrivate MountPropagation = "private"
	// MountPropagationRShared RSHARED
	MountPropagationRShared MountPropagation = "rshared"
	// MountPropagationShared SHARED
	MountPropagationShared MountPropagation = "shared"
	// MountPropagationRSlave RSLAVE
	MountPropagationRSlave MountPropagation = "rslave"
	// MountPropagationSlave SLAVE
	MountPropagationSlave MountPropagation = "slave"
)

type MountType

type MountType string

MountType represents the type of a mount.

const (
	// MountTypeBind BIND
	MountTypeBind MountType = "bind"
	// MountTypeVolume VOLUME
	MountTypeVolume MountType = "volume"
)

type Network

type Network struct {
	ID string
	Meta
	Spec        NetworkSpec  `json:",omitempty"`
	DriverState Driver       `json:",omitempty"`
	IPAMOptions *IPAMOptions `json:",omitempty"`
}

Network represents a network.

type NetworkAttachment

type NetworkAttachment struct {
	Network   Network  `json:",omitempty"`
	Addresses []string `json:",omitempty"`
}

NetworkAttachment represents a network attachment.

type NetworkAttachmentConfig

type NetworkAttachmentConfig struct {
	Target  string   `json:",omitempty"`
	Aliases []string `json:",omitempty"`
}

NetworkAttachmentConfig represents the configuration of a network attachment.

type NetworkSpec

type NetworkSpec struct {
	Annotations
	DriverConfiguration *Driver      `json:",omitempty"`
	IPv6Enabled         bool         `json:",omitempty"`
	Internal            bool         `json:",omitempty"`
	IPAMOptions         *IPAMOptions `json:",omitempty"`
}

NetworkSpec represents the spec of a network.

type Node

type Node struct {
	ID string
	Meta

	Spec          NodeSpec        `json:",omitempty"`
	Description   NodeDescription `json:",omitempty"`
	Status        NodeStatus      `json:",omitempty"`
	ManagerStatus *ManagerStatus  `json:",omitempty"`
}

Node represents a node.

type NodeAvailability

type NodeAvailability string

NodeAvailability represents the availability of a node.

const (
	// NodeAvailabilityActive ACTIVE
	NodeAvailabilityActive NodeAvailability = "active"
	// NodeAvailabilityPause PAUSE
	NodeAvailabilityPause NodeAvailability = "pause"
	// NodeAvailabilityDrain DRAIN
	NodeAvailabilityDrain NodeAvailability = "drain"
)

type NodeDescription

type NodeDescription struct {
	Hostname  string            `json:",omitempty"`
	Platform  Platform          `json:",omitempty"`
	Resources Resources         `json:",omitempty"`
	Engine    EngineDescription `json:",omitempty"`
}

NodeDescription represents the description of a node.

type NodeRole

type NodeRole string

NodeRole represents the role of a node.

const (
	// NodeRoleWorker WORKER
	NodeRoleWorker NodeRole = "worker"
	// NodeRoleManager MANAGER
	NodeRoleManager NodeRole = "manager"
)

type NodeSpec

type NodeSpec struct {
	Annotations
	Role         NodeRole         `json:",omitempty"`
	Availability NodeAvailability `json:",omitempty"`
}

NodeSpec represents the spec of a node.

type NodeState

type NodeState string

NodeState represents the state of a node.

const (
	// NodeStateUnknown UNKNOWN
	NodeStateUnknown NodeState = "unknown"
	// NodeStateDown DOWN
	NodeStateDown NodeState = "down"
	// NodeStateReady READY
	NodeStateReady NodeState = "ready"
	// NodeStateDisconnected DISCONNECTED
	NodeStateDisconnected NodeState = "disconnected"
)

type NodeStatus

type NodeStatus struct {
	State   NodeState `json:",omitempty"`
	Message string    `json:",omitempty"`
}

NodeStatus represents the status of a node.

type OrchestrationConfig

type OrchestrationConfig struct {
	TaskHistoryRetentionLimit int64 `json:",omitempty"`
}

OrchestrationConfig represents orchestration configuration.

type Peer

type Peer struct {
	NodeID string
	Addr   string
}

Peer represents a peer.

type Placement

type Placement struct {
	Constraints []string `json:",omitempty"`
}

Placement represents orchestration parameters.

type Platform

type Platform struct {
	Architecture string `json:",omitempty"`
	OS           string `json:",omitempty"`
}

Platform represents the platfrom (Arch/OS).

type PluginDescription

type PluginDescription struct {
	Type string `json:",omitempty"`
	Name string `json:",omitempty"`
}

PluginDescription represents the description of an engine plugin.

type PortConfig

type PortConfig struct {
	Name          string             `json:",omitempty"`
	Protocol      PortConfigProtocol `json:",omitempty"`
	TargetPort    uint32             `json:",omitempty"`
	PublishedPort uint32             `json:",omitempty"`
}

PortConfig represents the config of a port.

type PortConfigProtocol

type PortConfigProtocol string

PortConfigProtocol represents the protocol of a port.

const (

	// PortConfigProtocolTCP TCP
	PortConfigProtocolTCP PortConfigProtocol = "tcp"
	// PortConfigProtocolUDP UDP
	PortConfigProtocolUDP PortConfigProtocol = "udp"
)

type RaftConfig

type RaftConfig struct {
	SnapshotInterval           uint64 `json:",omitempty"`
	KeepOldSnapshots           uint64 `json:",omitempty"`
	LogEntriesForSlowFollowers uint64 `json:",omitempty"`
	HeartbeatTick              uint32 `json:",omitempty"`
	ElectionTick               uint32 `json:",omitempty"`
}

RaftConfig represents raft configuration.

type Reachability

type Reachability string

Reachability represents the reachability of a node.

const (
	// ReachabilityUnknown UNKNOWN
	ReachabilityUnknown Reachability = "unknown"
	// ReachabilityUnreachable UNREACHABLE
	ReachabilityUnreachable Reachability = "unreachable"
	// ReachabilityReachable REACHABLE
	ReachabilityReachable Reachability = "reachable"
)

type ReplicatedService

type ReplicatedService struct {
	Replicas *uint64 `json:",omitempty"`
}

ReplicatedService is a kind of ServiceMode.

type ResolutionMode

type ResolutionMode string

ResolutionMode represents a resolution mode.

const (
	// ResolutionModeVIP VIP
	ResolutionModeVIP ResolutionMode = "vip"
	// ResolutionModeDNSRR DNSRR
	ResolutionModeDNSRR ResolutionMode = "dnsrr"
)

type ResourceRequirements

type ResourceRequirements struct {
	Limits       *Resources `json:",omitempty"`
	Reservations *Resources `json:",omitempty"`
}

ResourceRequirements represents resources requirements.

type Resources

type Resources struct {
	NanoCPUs    int64 `json:",omitempty"`
	MemoryBytes int64 `json:",omitempty"`
}

Resources represents resources (CPU/Memory).

type RestartPolicy

type RestartPolicy struct {
	Condition   RestartPolicyCondition `json:",omitempty"`
	Delay       *time.Duration         `json:",omitempty"`
	MaxAttempts *uint64                `json:",omitempty"`
	Window      *time.Duration         `json:",omitempty"`
}

RestartPolicy represents the restart policy.

type RestartPolicyCondition

type RestartPolicyCondition string

RestartPolicyCondition represents when to restart.

const (
	// RestartPolicyConditionNone NONE
	RestartPolicyConditionNone RestartPolicyCondition = "none"
	// RestartPolicyConditionOnFailure ON_FAILURE
	RestartPolicyConditionOnFailure RestartPolicyCondition = "on-failure"
	// RestartPolicyConditionAny ANY
	RestartPolicyConditionAny RestartPolicyCondition = "any"
)

type Service

type Service struct {
	ID string
	Meta
	Spec         ServiceSpec  `json:",omitempty"`
	Endpoint     Endpoint     `json:",omitempty"`
	UpdateStatus UpdateStatus `json:",omitempty"`
}

Service represents a service.

type ServiceMode

type ServiceMode struct {
	Replicated *ReplicatedService `json:",omitempty"`
	Global     *GlobalService     `json:",omitempty"`
}

ServiceMode represents the mode of a service.

type ServiceSpec

type ServiceSpec struct {
	Annotations

	// TaskTemplate defines how the service should construct new tasks when
	// orchestrating this service.
	TaskTemplate TaskSpec                  `json:",omitempty"`
	Mode         ServiceMode               `json:",omitempty"`
	UpdateConfig *UpdateConfig             `json:",omitempty"`
	Networks     []NetworkAttachmentConfig `json:",omitempty"`
	EndpointSpec *EndpointSpec             `json:",omitempty"`
}

ServiceSpec represents the spec of a service.

type Spec

type Spec struct {
	Annotations

	Orchestration OrchestrationConfig `json:",omitempty"`
	Raft          RaftConfig          `json:",omitempty"`
	Dispatcher    DispatcherConfig    `json:",omitempty"`
	CAConfig      CAConfig            `json:",omitempty"`
	TaskDefaults  TaskDefaults        `json:",omitempty"`
}

Spec represents the spec of a swarm.

type Swarm

type Swarm struct {
	ClusterInfo
	JoinTokens JoinTokens
}

Swarm represents a swarm.

type Task

type Task struct {
	ID string
	Meta

	Spec                TaskSpec            `json:",omitempty"`
	ServiceID           string              `json:",omitempty"`
	Slot                int                 `json:",omitempty"`
	NodeID              string              `json:",omitempty"`
	Status              TaskStatus          `json:",omitempty"`
	DesiredState        TaskState           `json:",omitempty"`
	NetworksAttachments []NetworkAttachment `json:",omitempty"`
}

Task represents a task.

type TaskDefaults

type TaskDefaults struct {
	// LogDriver selects the log driver to use for tasks created in the
	// orchestrator if unspecified by a service.
	//
	// Updating this value will only have an affect on new tasks. Old tasks
	// will continue use their previously configured log driver until
	// recreated.
	LogDriver *Driver `json:",omitempty"`
}

TaskDefaults parameterizes cluster-level task creation with default values.

type TaskSpec

type TaskSpec struct {
	ContainerSpec ContainerSpec         `json:",omitempty"`
	Resources     *ResourceRequirements `json:",omitempty"`
	RestartPolicy *RestartPolicy        `json:",omitempty"`
	Placement     *Placement            `json:",omitempty"`

	// LogDriver specifies the LogDriver to use for tasks created from this
	// spec. If not present, the one on cluster default on swarm.Spec will be
	// used, finally falling back to the engine default if not specified.
	LogDriver *Driver `json:",omitempty"`
}

TaskSpec represents the spec of a task.

type TaskState

type TaskState string

TaskState represents the state of a task.

const (
	// TaskStateNew NEW
	TaskStateNew TaskState = "new"
	// TaskStateAllocated ALLOCATED
	TaskStateAllocated TaskState = "allocated"
	// TaskStatePending PENDING
	TaskStatePending TaskState = "pending"
	// TaskStateAssigned ASSIGNED
	TaskStateAssigned TaskState = "assigned"
	// TaskStateAccepted ACCEPTED
	TaskStateAccepted TaskState = "accepted"
	// TaskStatePreparing PREPARING
	TaskStatePreparing TaskState = "preparing"
	// TaskStateReady READY
	TaskStateReady TaskState = "ready"
	// TaskStateStarting STARTING
	TaskStateStarting TaskState = "starting"
	// TaskStateRunning RUNNING
	TaskStateRunning TaskState = "running"
	// TaskStateComplete COMPLETE
	TaskStateComplete TaskState = "complete"
	// TaskStateShutdown SHUTDOWN
	TaskStateShutdown TaskState = "shutdown"
	// TaskStateFailed FAILED
	TaskStateFailed TaskState = "failed"
	// TaskStateRejected REJECTED
	TaskStateRejected TaskState = "rejected"
)

type TaskStatus

type TaskStatus struct {
	Timestamp       time.Time       `json:",omitempty"`
	State           TaskState       `json:",omitempty"`
	Message         string          `json:",omitempty"`
	Err             string          `json:",omitempty"`
	ContainerStatus ContainerStatus `json:",omitempty"`
}

TaskStatus represents the status of a task.

type UpdateConfig

type UpdateConfig struct {
	Parallelism   uint64        `json:",omitempty"`
	Delay         time.Duration `json:",omitempty"`
	FailureAction string        `json:",omitempty"`
}

UpdateConfig represents the update configuration.

type UpdateFlags

type UpdateFlags struct {
	RotateWorkerToken  bool
	RotateManagerToken bool
}

UpdateFlags contains flags for SwarmUpdate.

type UpdateState

type UpdateState string

UpdateState is the state of a service update.

const (
	// UpdateStateUpdating is the updating state.
	UpdateStateUpdating UpdateState = "updating"
	// UpdateStatePaused is the paused state.
	UpdateStatePaused UpdateState = "paused"
	// UpdateStateCompleted is the completed state.
	UpdateStateCompleted UpdateState = "completed"
)

type UpdateStatus

type UpdateStatus struct {
	State       UpdateState `json:",omitempty"`
	StartedAt   time.Time   `json:",omitempty"`
	CompletedAt time.Time   `json:",omitempty"`
	Message     string      `json:",omitempty"`
}

UpdateStatus reports the status of a service update.

type Version

type Version struct {
	Index uint64 `json:",omitempty"`
}

Version represent the internal object version.

type VolumeOptions

type VolumeOptions struct {
	NoCopy       bool              `json:",omitempty"`
	Labels       map[string]string `json:",omitempty"`
	DriverConfig *Driver           `json:",omitempty"`
}

VolumeOptions represents the options for a mount of type volume.

Jump to

Keyboard shortcuts

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