swarm

package
v0.0.0-...-10febd9 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2017 License: Apache-2.0, Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptancePolicy

type AcceptancePolicy struct {
	Policies []Policy `json:",omitempty"`
}

AcceptancePolicy represents the list of policies.

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 define options specific to mounts of type "bind".

type CAConfig

type CAConfig struct {
	NodeCertExpiry time.Duration `json:",omitempty"`
}

CAConfig represents CA configuration.

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 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

	LocalNodeState   LocalNodeState
	ControlAvailable bool
	Error            string

	RemoteManagers []Peer
	Nodes          int
	Managers       int
	CACertHash     string
}

Info represents generic information about swarm.

type InitRequest

type InitRequest struct {
	ListenAddr      string
	ForceNewCluster bool
	Spec            Spec
}

InitRequest is the request used to init a swarm.

type JoinRequest

type JoinRequest struct {
	ListenAddr  string
	RemoteAddrs []string
	Secret      string // accept by secret
	CACertHash  string
	Manager     bool
}

JoinRequest is the request used to join a 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"`
	Writable 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 attchement.

type NetworkAttachmentConfig

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

NetworkAttachmentConfig represents the configuration of a network attachement.

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 NodeMembership

type NodeMembership string

NodeMembership represents the membership of a node.

const (
	// NodeMembershipPending PENDING
	NodeMembershipPending NodeMembership = "pending"
	// NodeMembershipAccepted ACCEPTED
	NodeMembershipAccepted NodeMembership = "accepted"
)

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"`
	Membership   NodeMembership   `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 ochestration 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 Policy

type Policy struct {
	Role       NodeRole
	Autoaccept bool
	Secret     *string `json:",omitempty"`
}

Policy represents a role, autoaccept and secret.

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"`
}

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
	// ochestrating 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

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

Spec represents the spec of a swarm.

type Swarm

type Swarm struct {
	ID string
	Meta
	Spec Spec
}

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 TaskSpec

type TaskSpec struct {
	ContainerSpec ContainerSpec         `json:",omitempty"`
	Resources     *ResourceRequirements `json:",omitempty"`
	RestartPolicy *RestartPolicy        `json:",omitempty"`
	Placement     *Placement            `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"`
}

UpdateConfig represents the update configuration.

type Version

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

Version represent the internal object version.

type VolumeOptions

type VolumeOptions struct {
	Populate     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