Documentation ¶
Index ¶
- Variables
- type Cluster
- func (c *Cluster) AttachNetwork(target string, containerID string, addresses []string) (*network.NetworkingConfig, error)
- func (c *Cluster) Cleanup()
- func (c *Cluster) CreateNetwork(s apitypes.NetworkCreateRequest) (string, error)
- func (c *Cluster) CreateSecret(s types.SecretSpec) (string, error)
- func (c *Cluster) CreateService(s types.ServiceSpec, encodedAuth string) (string, error)
- func (c *Cluster) DetachNetwork(target string, containerID string) error
- func (c *Cluster) GetAdvertiseAddress() string
- func (c *Cluster) GetListenAddress() string
- func (c *Cluster) GetLocalAddress() string
- func (c *Cluster) GetNetwork(input string) (apitypes.NetworkResource, error)
- func (c *Cluster) GetNetworks() ([]apitypes.NetworkResource, error)
- func (c *Cluster) GetNode(input string) (types.Node, error)
- func (c *Cluster) GetNodes(options apitypes.NodeListOptions) ([]types.Node, error)
- func (c *Cluster) GetRemoteAddress() string
- func (c *Cluster) GetSecret(id string) (types.Secret, error)
- func (c *Cluster) GetSecrets(options apitypes.SecretListOptions) ([]types.Secret, error)
- func (c *Cluster) GetService(input string) (types.Service, error)
- func (c *Cluster) GetServices(options apitypes.ServiceListOptions) ([]types.Service, error)
- func (c *Cluster) GetTask(input string) (types.Task, error)
- func (c *Cluster) GetTasks(options apitypes.TaskListOptions) ([]types.Task, error)
- func (c *Cluster) GetUnlockKey() (string, error)
- func (c *Cluster) Info() types.Info
- func (c *Cluster) Init(req types.InitRequest) (string, error)
- func (c *Cluster) Inspect() (types.Swarm, error)
- func (c *Cluster) IsAgent() bool
- func (c *Cluster) IsManager() bool
- func (c *Cluster) Join(req types.JoinRequest) error
- func (c *Cluster) Leave(force bool) error
- func (c *Cluster) ListenClusterEvents() <-chan struct{}
- func (c *Cluster) RemoveNetwork(input string) error
- func (c *Cluster) RemoveNode(input string, force bool) error
- func (c *Cluster) RemoveSecret(id string) error
- func (c *Cluster) RemoveService(input string) error
- func (c *Cluster) ServiceLogs(ctx context.Context, input string, config *backend.ContainerLogsConfig, ...) error
- func (c *Cluster) UnlockSwarm(req types.UnlockRequest) error
- func (c *Cluster) Update(version uint64, spec types.Spec, flags types.UpdateFlags) error
- func (c *Cluster) UpdateAttachment(target, containerID string, config *network.NetworkingConfig) error
- func (c *Cluster) UpdateNode(nodeID string, version uint64, spec types.NodeSpec) error
- func (c *Cluster) UpdateSecret(id string, version uint64, spec types.SecretSpec) error
- func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec types.ServiceSpec, ...) error
- func (c *Cluster) WaitForDetachment(ctx context.Context, networkName, networkID, taskID, containerID string) error
- type Config
- type NetworkSubnetsProvider
Constants ¶
This section is empty.
Variables ¶
var ErrNoSwarm = fmt.Errorf("This node is not part of a swarm")
ErrNoSwarm is returned on leaving a cluster that was never initialized
var ErrPendingSwarmExists = fmt.Errorf("This node is processing an existing join request that has not succeeded yet. Use \"docker swarm leave\" to cancel the current request.")
ErrPendingSwarmExists is returned on initialize or join request for a cluster that is already processing a similar request but has not succeeded yet.
var ErrSwarmCertificatesExpired = errors.New("Swarm certificates have expired. To replace them, leave the swarm and join again.")
ErrSwarmCertificatesExipred is returned if docker was not started for the whole validity period and they had no chance to renew automatically.
var ErrSwarmExists = fmt.Errorf("This node is already part of a swarm. Use \"docker swarm leave\" to leave this swarm and join another one.")
ErrSwarmExists is returned on initialize or join request for a cluster that has already been activated
var ErrSwarmJoinTimeoutReached = fmt.Errorf("Timeout was reached before node was joined. The attempt to join the swarm will continue in the background. Use the \"docker info\" command to see the current swarm status of your node.")
ErrSwarmJoinTimeoutReached is returned when cluster join could not complete before timeout was reached.
var ErrSwarmLocked = fmt.Errorf("Swarm is encrypted and needs to be unlocked before it can be used. Please use \"docker swarm unlock\" to unlock it.")
ErrSwarmLocked is returned if the swarm is encrypted and needs a key to unlock it.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
Cluster provides capabilities to participate in a cluster as a worker or a manager.
func (*Cluster) AttachNetwork ¶ added in v1.13.0
func (c *Cluster) AttachNetwork(target string, containerID string, addresses []string) (*network.NetworkingConfig, error)
AttachNetwork generates an attachment request towards the manager.
func (*Cluster) Cleanup ¶
func (c *Cluster) Cleanup()
Cleanup stops active swarm node. This is run before daemon shutdown.
func (*Cluster) CreateNetwork ¶
func (c *Cluster) CreateNetwork(s apitypes.NetworkCreateRequest) (string, error)
CreateNetwork creates a new cluster managed network.
func (*Cluster) CreateSecret ¶ added in v1.13.0
func (c *Cluster) CreateSecret(s types.SecretSpec) (string, error)
CreateSecret creates a new secret in a managed swarm cluster.
func (*Cluster) CreateService ¶
CreateService creates a new service in a managed swarm cluster.
func (*Cluster) DetachNetwork ¶ added in v1.13.0
DetachNetwork unblocks the waiters waiting on WaitForDetachment so that a request to detach can be generated towards the manager.
func (*Cluster) GetAdvertiseAddress ¶
GetAdvertiseAddress returns the remotely reachable address of this node.
func (*Cluster) GetListenAddress ¶ added in v1.12.2
GetListenAddress returns the listen address.
func (*Cluster) GetLocalAddress ¶
GetLocalAddress returns the local address.
func (*Cluster) GetNetwork ¶
func (c *Cluster) GetNetwork(input string) (apitypes.NetworkResource, error)
GetNetwork returns a cluster network by an ID.
func (*Cluster) GetNetworks ¶
func (c *Cluster) GetNetworks() ([]apitypes.NetworkResource, error)
GetNetworks returns all current cluster managed networks.
func (*Cluster) GetRemoteAddress ¶
GetRemoteAddress returns a known advertise address of a remote manager if available. todo: change to array/connect with info
func (*Cluster) GetSecret ¶ added in v1.13.0
GetSecret returns a secret from a managed swarm cluster
func (*Cluster) GetSecrets ¶ added in v1.13.0
GetSecrets returns all secrets of a managed swarm cluster.
func (*Cluster) GetService ¶
GetService returns a service based on an ID or name.
func (*Cluster) GetServices ¶
GetServices returns all services of a managed swarm cluster.
func (*Cluster) GetUnlockKey ¶ added in v1.13.0
GetUnlockKey returns the unlock key for the swarm.
func (*Cluster) Init ¶
func (c *Cluster) Init(req types.InitRequest) (string, error)
Init initializes new cluster from user provided request.
func (*Cluster) Inspect ¶
Inspect retrieves the configuration properties of a managed swarm cluster.
func (*Cluster) Join ¶
func (c *Cluster) Join(req types.JoinRequest) error
Join makes current Cluster part of an existing swarm cluster.
func (*Cluster) ListenClusterEvents ¶
func (c *Cluster) ListenClusterEvents() <-chan struct{}
ListenClusterEvents returns a channel that receives messages on cluster participation changes. todo: make cancelable and accessible to multiple callers
func (*Cluster) RemoveNetwork ¶
RemoveNetwork removes a cluster network.
func (*Cluster) RemoveNode ¶
RemoveNode removes a node from a cluster
func (*Cluster) RemoveSecret ¶ added in v1.13.0
RemoveSecret removes a secret from a managed swarm cluster.
func (*Cluster) RemoveService ¶
RemoveService removes a service from a managed swarm cluster.
func (*Cluster) ServiceLogs ¶ added in v1.13.0
func (c *Cluster) ServiceLogs(ctx context.Context, input string, config *backend.ContainerLogsConfig, started chan struct{}) error
ServiceLogs collects service logs and writes them back to `config.OutStream`
func (*Cluster) UnlockSwarm ¶ added in v1.13.0
func (c *Cluster) UnlockSwarm(req types.UnlockRequest) error
UnlockSwarm provides a key to decrypt data that is encrypted at rest.
func (*Cluster) UpdateAttachment ¶ added in v1.13.0
func (c *Cluster) UpdateAttachment(target, containerID string, config *network.NetworkingConfig) error
UpdateAttachment signals the attachment config to the attachment waiter who is trying to start or attach the container to the network.
func (*Cluster) UpdateNode ¶
UpdateNode updates existing nodes properties.
func (*Cluster) UpdateSecret ¶ added in v1.13.0
UpdateSecret updates a secret in a managed swarm cluster. Note: this is not exposed to the CLI but is available from the API only
func (*Cluster) UpdateService ¶
func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec types.ServiceSpec, encodedAuth string, registryAuthFrom string) error
UpdateService updates existing service to match new properties.
type Config ¶
type Config struct { Root string Name string Backend executorpkg.Backend NetworkSubnetsProvider NetworkSubnetsProvider // DefaultAdvertiseAddr is the default host/IP or network interface to use // if no AdvertiseAddr value is specified. DefaultAdvertiseAddr string // path to store runtime state, such as the swarm control socket RuntimeRoot string }
Config provides values for Cluster.