Documentation
¶
Index ¶
- Constants
- type Annotations
- type CAConfig
- type ClusterInfo
- type ContainerSpec
- type ContainerStatus
- type DNSConfig
- type DispatcherConfig
- type Driver
- type EncryptionConfig
- type Endpoint
- type EndpointSpec
- type EndpointVirtualIP
- type EngineDescription
- type ExternalCA
- type ExternalCAProtocol
- type GlobalService
- type IPAMConfig
- type IPAMOptions
- type Info
- type InitRequest
- type JoinRequest
- type JoinTokens
- type LocalNodeState
- type ManagerStatus
- type Meta
- type Network
- type NetworkAttachment
- type NetworkAttachmentConfig
- type NetworkSpec
- type Node
- type NodeAvailability
- type NodeDescription
- type NodeRole
- type NodeSpec
- type NodeState
- type NodeStatus
- type OrchestrationConfig
- type Peer
- type Placement
- type Platform
- type PluginDescription
- type PortConfig
- type PortConfigProtocol
- type PortConfigPublishMode
- type PortStatus
- type RaftConfig
- type Reachability
- type ReplicatedService
- type ResolutionMode
- type ResourceRequirements
- type Resources
- type RestartPolicy
- type RestartPolicyCondition
- type Secret
- type SecretReference
- type SecretReferenceFileTarget
- type SecretSpec
- type Service
- type ServiceMode
- type ServiceSpec
- type Spec
- type Swarm
- type Task
- type TaskDefaults
- type TaskSpec
- type TaskState
- type TaskStatus
- type UnlockRequest
- type UpdateConfig
- type UpdateFlags
- type UpdateState
- type UpdateStatus
- type Version
Constants ¶
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 CAConfig ¶
type CAConfig struct {
// NodeCertExpiry is the duration certificates should be issued for
NodeCertExpiry time.Duration `json:",omitempty"`
// ExternalCAs is a list of CAs to which a manager node will make
// certificate signing requests for node certificates.
ExternalCAs []*ExternalCA `json:",omitempty"`
}
CAConfig represents CA configuration.
type ClusterInfo ¶
ClusterInfo represents info about 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"`
Hostname string `json:",omitempty"`
Env []string `json:",omitempty"`
Dir string `json:",omitempty"`
User string `json:",omitempty"`
Groups []string `json:",omitempty"`
TTY bool `json:",omitempty"`
OpenStdin bool `json:",omitempty"`
Mounts []mount.Mount `json:",omitempty"`
StopGracePeriod *time.Duration `json:",omitempty"`
Healthcheck *container.HealthConfig `json:",omitempty"`
// The format of extra hosts on swarmkit is specified in:
// http://man7.org/linux/man-pages/man5/hosts.5.html
// IP_address canonical_hostname [aliases...]
Hosts []string `json:",omitempty"`
DNSConfig *DNSConfig `json:",omitempty"`
Secrets []*SecretReference `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 DNSConfig ¶
type DNSConfig struct {
// Nameservers specifies the IP addresses of the name servers
Nameservers []string `json:",omitempty"`
// Search specifies the search list for host-name lookup
Search []string `json:",omitempty"`
// Options allows certain internal resolver variables to be modified
Options []string `json:",omitempty"`
}
DNSConfig specifies DNS related configurations in resolver configuration file (resolv.conf) Detailed documentation is available in: http://man7.org/linux/man-pages/man5/resolv.conf.5.html `nameserver`, `search`, `options` have been supported. TODO: `domain` is not supported yet.
type DispatcherConfig ¶
type DispatcherConfig struct {
// HeartbeatPeriod defines how often agent should send heartbeats to
// dispatcher.
HeartbeatPeriod time.Duration `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, logging).
type EncryptionConfig ¶
type EncryptionConfig struct {
// AutoLockManagers specifies whether or not managers TLS keys and raft data
// should be encrypted at rest in such a way that they must be unlocked
// before the manager node starts up again.
AutoLockManagers bool
}
EncryptionConfig controls at-rest encryption of data and keys.
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 is the protocol used by this external CA.
Protocol ExternalCAProtocol
// URL is the URL where the external CA can be reached.
URL string
// Options is a set of additional key/value pairs whose interpretation
// depends on the specified CA type.
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 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
AutoLockManagers bool
}
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 is the join token workers may use to join the swarm.
Worker string
// Manager is the join token managers may use to join the swarm.
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" // LocalNodeStateLocked LOCKED LocalNodeStateLocked LocalNodeState = "locked" )
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 a base object inherited by most of the other once.
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"`
Attachable bool `json:",omitempty"`
IPAMOptions *IPAMOptions `json:",omitempty"`
}
NetworkSpec represents the spec of a network.
type Node ¶
type Node struct {
ID string
Meta
// Spec defines the desired state of the node as specified by the user.
// The system will honor this and will *never* modify it.
Spec NodeSpec `json:",omitempty"`
// Description encapsulates the properties of the Node as reported by the
// agent.
Description NodeDescription `json:",omitempty"`
// Status provides the current status of the node, as seen by the manager.
Status NodeStatus `json:",omitempty"`
// ManagerStatus provides the current status of the node's manager
// component, if the node is a manager.
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 NodeSpec ¶
type NodeSpec struct {
Annotations
Role NodeRole `json:",omitempty"`
Availability NodeAvailability `json:",omitempty"`
}
NodeSpec represents the spec of a node.
type NodeStatus ¶
type NodeStatus struct {
State NodeState `json:",omitempty"`
Message string `json:",omitempty"`
Addr string `json:",omitempty"`
}
NodeStatus represents the status of a node.
type OrchestrationConfig ¶
type OrchestrationConfig struct {
// TaskHistoryRetentionLimit is the number of historic tasks to keep per instance or
// node. If negative, never remove completed or failed tasks.
TaskHistoryRetentionLimit *int64 `json:",omitempty"`
}
OrchestrationConfig represents orchestration configuration.
type Placement ¶
type Placement struct {
Constraints []string `json:",omitempty"`
}
Placement represents orchestration parameters.
type PluginDescription ¶
PluginDescription represents the description of an engine plugin.
type PortConfig ¶
type PortConfig struct {
Name string `json:",omitempty"`
Protocol PortConfigProtocol `json:",omitempty"`
// TargetPort is the port inside the container
TargetPort uint32 `json:",omitempty"`
// PublishedPort is the port on the swarm hosts
PublishedPort uint32 `json:",omitempty"`
// PublishMode is the mode in which port is published
PublishMode PortConfigPublishMode `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 PortConfigPublishMode ¶
type PortConfigPublishMode string
PortConfigPublishMode represents the mode in which the port is to be published.
const ( // PortConfigPublishModeIngress is used for ports published // for ingress load balancing using routing mesh. PortConfigPublishModeIngress PortConfigPublishMode = "ingress" // PortConfigPublishModeHost is used for ports published // for direct host level access on the host where the task is running. PortConfigPublishModeHost PortConfigPublishMode = "host" )
type PortStatus ¶
type PortStatus struct {
Ports []PortConfig `json:",omitempty"`
}
PortStatus represents the port status of a task's host ports whose service has published host ports
type RaftConfig ¶
type RaftConfig struct {
// SnapshotInterval is the number of log entries between snapshots.
SnapshotInterval uint64 `json:",omitempty"`
// KeepOldSnapshots is the number of snapshots to keep beyond the
// current snapshot.
KeepOldSnapshots *uint64 `json:",omitempty"`
// LogEntriesForSlowFollowers is the number of log entries to keep
// around to sync up slow followers after a snapshot is created.
LogEntriesForSlowFollowers uint64 `json:",omitempty"`
// ElectionTick is the number of ticks that a follower will wait for a message
// from the leader before becoming a candidate and starting an election.
// ElectionTick must be greater than HeartbeatTick.
//
// A tick currently defaults to one second, so these translate directly to
// seconds currently, but this is NOT guaranteed.
ElectionTick int
// HeartbeatTick is the number of ticks between heartbeats. Every
// HeartbeatTick ticks, the leader will send a heartbeat to the
// followers.
//
// A tick currently defaults to one second, so these translate directly to
// seconds currently, but this is NOT guaranteed.
HeartbeatTick int
}
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 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 SecretReference ¶
type SecretReference struct {
File *SecretReferenceFileTarget
SecretID string
SecretName string
}
SecretReference is a reference to a secret in swarm
type SecretReferenceFileTarget ¶
SecretReferenceFileTarget is a file target in a secret reference
type SecretSpec ¶
type SecretSpec struct {
Annotations
Data []byte `json:",omitempty"`
}
SecretSpec represents a secret specification from a secret in swarm
type Service ¶
type Service struct {
ID string
Meta
Spec ServiceSpec `json:",omitempty"`
PreviousSpec *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 field in ServiceSpec is deprecated. The
// same field in TaskSpec should be used instead.
// This field will be removed in a future release.
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"`
EncryptionConfig EncryptionConfig `json:",omitempty"`
}
Spec represents the spec of a swarm.
type Task ¶
type Task struct {
ID string
Meta
Annotations
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"`
Networks []NetworkAttachmentConfig `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"`
// ForceUpdate is a counter that triggers an update even if no relevant
// parameters have been changed.
ForceUpdate uint64
}
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"`
PortStatus PortStatus `json:",omitempty"`
}
TaskStatus represents the status of a task.
type UnlockRequest ¶
type UnlockRequest struct {
// UnlockKey is the unlock key in ASCII-armored format.
UnlockKey string
}
UnlockRequest is the request used to unlock a swarm.
type UpdateConfig ¶
type UpdateConfig struct {
// Maximum number of tasks to be updated in one iteration.
// 0 means unlimited parallelism.
Parallelism uint64
// Amount of time between updates.
Delay time.Duration `json:",omitempty"`
// FailureAction is the action to take when an update failures.
FailureAction string `json:",omitempty"`
// Monitor indicates how long to monitor a task for failure after it is
// created. If the task fails by ending up in one of the states
// REJECTED, COMPLETED, or FAILED, within Monitor from its creation,
// this counts as a failure. If it fails after Monitor, it does not
// count as a failure. If Monitor is unspecified, a default value will
// be used.
Monitor time.Duration `json:",omitempty"`
// MaxFailureRatio is the fraction of tasks that may fail during
// an update before the failure action is invoked. Any task created by
// the current update which ends up in one of the states REJECTED,
// COMPLETED or FAILED within Monitor from its creation counts as a
// failure. The number of failures is divided by the number of tasks
// being updated, and if this fraction is greater than
// MaxFailureRatio, the failure action is invoked.
//
// If the failure action is CONTINUE, there is no effect.
// If the failure action is PAUSE, no more tasks will be updated until
// another update is started.
MaxFailureRatio float32
}
UpdateConfig represents the update configuration.
type UpdateFlags ¶
type UpdateFlags struct {
RotateWorkerToken bool
RotateManagerToken bool
RotateManagerUnlockKey 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.