docker: Index | Files | Directories

package cluster

import ""


Package Files

cluster.go configs.go errors.go filters.go helpers.go listen_addr.go listen_addr_linux.go networks.go noderunner.go nodes.go secrets.go services.go swarm.go tasks.go utils.go

type Cluster Uses

type Cluster struct {
    // contains filtered or unexported fields

Cluster provides capabilities to participate in a cluster as a worker or a manager.

func New Uses

func New(config Config) (*Cluster, error)

New creates a new Cluster instance using provided config.

func (*Cluster) AttachNetwork Uses

func (c *Cluster) AttachNetwork(target string, containerID string, addresses []string) (*network.NetworkingConfig, error)

AttachNetwork generates an attachment request towards the manager.

func (*Cluster) Cleanup Uses

func (c *Cluster) Cleanup()

Cleanup stops active swarm node. This is run before daemon shutdown.

func (*Cluster) CreateConfig Uses

func (c *Cluster) CreateConfig(s types.ConfigSpec) (string, error)

CreateConfig creates a new config in a managed swarm cluster.

func (*Cluster) CreateNetwork Uses

func (c *Cluster) CreateNetwork(s apitypes.NetworkCreateRequest) (string, error)

CreateNetwork creates a new cluster managed network.

func (*Cluster) CreateSecret Uses

func (c *Cluster) CreateSecret(s types.SecretSpec) (string, error)

CreateSecret creates a new secret in a managed swarm cluster.

func (*Cluster) CreateService Uses

func (c *Cluster) CreateService(s types.ServiceSpec, encodedAuth string, queryRegistry bool) (*apitypes.ServiceCreateResponse, error)

CreateService creates a new service in a managed swarm cluster.

func (*Cluster) DetachNetwork Uses

func (c *Cluster) DetachNetwork(target string, containerID string) error

DetachNetwork unblocks the waiters waiting on WaitForDetachment so that a request to detach can be generated towards the manager.

func (*Cluster) GetAdvertiseAddress Uses

func (c *Cluster) GetAdvertiseAddress() string

GetAdvertiseAddress returns the remotely reachable address of this node.

func (*Cluster) GetConfig Uses

func (c *Cluster) GetConfig(input string) (types.Config, error)

GetConfig returns a config from a managed swarm cluster

func (*Cluster) GetConfigs Uses

func (c *Cluster) GetConfigs(options apitypes.ConfigListOptions) ([]types.Config, error)

GetConfigs returns all configs of a managed swarm cluster.

func (*Cluster) GetDataPathAddress Uses

func (c *Cluster) GetDataPathAddress() string

GetDataPathAddress returns the address to be used for the data path traffic, if specified.

func (*Cluster) GetListenAddress Uses

func (c *Cluster) GetListenAddress() string

GetListenAddress returns the listen address.

func (*Cluster) GetLocalAddress Uses

func (c *Cluster) GetLocalAddress() string

GetLocalAddress returns the local address.

func (*Cluster) GetNetwork Uses

func (c *Cluster) GetNetwork(input string) (apitypes.NetworkResource, error)

GetNetwork returns a cluster network by an ID.

func (*Cluster) GetNetworks Uses

func (c *Cluster) GetNetworks(filter filters.Args) ([]apitypes.NetworkResource, error)

GetNetworks returns all current cluster managed networks.

func (*Cluster) GetNetworksByName Uses

func (c *Cluster) GetNetworksByName(name string) ([]apitypes.NetworkResource, error)

GetNetworksByName returns cluster managed networks by name. It is ok to have multiple networks here. #18864

func (*Cluster) GetNode Uses

func (c *Cluster) GetNode(input string) (types.Node, error)

GetNode returns a node based on an ID.

func (*Cluster) GetNodes Uses

func (c *Cluster) GetNodes(options apitypes.NodeListOptions) ([]types.Node, error)

GetNodes returns a list of all nodes known to a cluster.

func (*Cluster) GetRemoteAddressList Uses

func (c *Cluster) GetRemoteAddressList() []string

GetRemoteAddressList returns the advertise address for each of the remote managers if available.

func (*Cluster) GetSecret Uses

func (c *Cluster) GetSecret(input string) (types.Secret, error)

GetSecret returns a secret from a managed swarm cluster

func (*Cluster) GetSecrets Uses

func (c *Cluster) GetSecrets(options apitypes.SecretListOptions) ([]types.Secret, error)

GetSecrets returns all secrets of a managed swarm cluster.

func (*Cluster) GetService Uses

func (c *Cluster) GetService(input string, insertDefaults bool) (types.Service, error)

GetService returns a service based on an ID or name.

func (*Cluster) GetServices Uses

func (c *Cluster) GetServices(options apitypes.ServiceListOptions) ([]types.Service, error)

GetServices returns all services of a managed swarm cluster.

func (*Cluster) GetTask Uses

func (c *Cluster) GetTask(input string) (types.Task, error)

GetTask returns a task by an ID.

func (*Cluster) GetTasks Uses

func (c *Cluster) GetTasks(options apitypes.TaskListOptions) ([]types.Task, error)

GetTasks returns a list of tasks matching the filter options.

func (*Cluster) GetUnlockKey Uses

func (c *Cluster) GetUnlockKey() (string, error)

GetUnlockKey returns the unlock key for the swarm.

func (*Cluster) GetWatchStream Uses

func (c *Cluster) GetWatchStream() chan *swarmapi.WatchMessage

GetWatchStream returns the channel to pass changes from store watch API

func (*Cluster) Info Uses

func (c *Cluster) Info() types.Info

Info returns information about the current cluster state.

func (*Cluster) Init Uses

func (c *Cluster) Init(req types.InitRequest) (string, error)

Init initializes new cluster from user provided request.

func (*Cluster) Inspect Uses

func (c *Cluster) Inspect() (types.Swarm, error)

Inspect retrieves the configuration properties of a managed swarm cluster.

func (*Cluster) IsAgent Uses

func (c *Cluster) IsAgent() bool

IsAgent returns true if Cluster is participating as a worker/agent.

func (*Cluster) IsManager Uses

func (c *Cluster) IsManager() bool

IsManager returns true if Cluster is participating as a manager.

func (*Cluster) Join Uses

func (c *Cluster) Join(req types.JoinRequest) error

Join makes current Cluster part of an existing swarm cluster.

func (*Cluster) Leave Uses

func (c *Cluster) Leave(force bool) error

Leave shuts down Cluster and removes current state.

func (*Cluster) ListenClusterEvents Uses

func (c *Cluster) ListenClusterEvents() <-chan lncluster.ConfigEventType

ListenClusterEvents returns a channel that receives messages on cluster participation changes. todo: make cancelable and accessible to multiple callers

func (*Cluster) RemoveConfig Uses

func (c *Cluster) RemoveConfig(input string) error

RemoveConfig removes a config from a managed swarm cluster.

func (*Cluster) RemoveNetwork Uses

func (c *Cluster) RemoveNetwork(input string) error

RemoveNetwork removes a cluster network.

func (*Cluster) RemoveNode Uses

func (c *Cluster) RemoveNode(input string, force bool) error

RemoveNode removes a node from a cluster

func (*Cluster) RemoveSecret Uses

func (c *Cluster) RemoveSecret(input string) error

RemoveSecret removes a secret from a managed swarm cluster.

func (*Cluster) RemoveService Uses

func (c *Cluster) RemoveService(input string) error

RemoveService removes a service from a managed swarm cluster.

func (*Cluster) SendClusterEvent Uses

func (c *Cluster) SendClusterEvent(event lncluster.ConfigEventType)

SendClusterEvent allows to send cluster events on the configEvent channel TODO This method should not be exposed. Currently it is used to notify the network controller that the keys are available

func (*Cluster) ServiceLogs Uses

func (c *Cluster) ServiceLogs(ctx context.Context, selector *backend.LogSelector, config *apitypes.ContainerLogsOptions) (<-chan *backend.LogMessage, error)

ServiceLogs collects service logs and writes them back to `config.OutStream`

func (*Cluster) Start Uses

func (c *Cluster) Start() error

Start the Cluster instance TODO The split between New and Start can be join again when the SendClusterEvent method is no longer required

func (*Cluster) UnlockSwarm Uses

func (c *Cluster) UnlockSwarm(req types.UnlockRequest) error

UnlockSwarm provides a key to decrypt data that is encrypted at rest.

func (*Cluster) Update Uses

func (c *Cluster) Update(version uint64, spec types.Spec, flags types.UpdateFlags) error

Update updates configuration of a managed swarm cluster.

func (*Cluster) UpdateAttachment Uses

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) UpdateConfig Uses

func (c *Cluster) UpdateConfig(input string, version uint64, spec types.ConfigSpec) error

UpdateConfig updates a config in a managed swarm cluster. Note: this is not exposed to the CLI but is available from the API only

func (*Cluster) UpdateNode Uses

func (c *Cluster) UpdateNode(input string, version uint64, spec types.NodeSpec) error

UpdateNode updates existing nodes properties.

func (*Cluster) UpdateSecret Uses

func (c *Cluster) UpdateSecret(input string, version uint64, spec types.SecretSpec) error

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 Uses

func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec types.ServiceSpec, flags apitypes.ServiceUpdateOptions, queryRegistry bool) (*apitypes.ServiceUpdateResponse, error)

UpdateService updates existing service to match new properties.

func (*Cluster) WaitForDetachment Uses

func (c *Cluster) WaitForDetachment(ctx context.Context, networkName, networkID, taskID, containerID string) error

WaitForDetachment waits for the container to stop or detach from the network.

type Config Uses

type Config struct {
    Root                   string
    Name                   string
    Backend                executorpkg.Backend
    ImageBackend           executorpkg.ImageBackend
    PluginBackend          plugin.Backend
    VolumeBackend          executorpkg.VolumeBackend
    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

    // WatchStream is a channel to pass watch API notifications to daemon
    WatchStream chan *swarmapi.WatchMessage

    // RaftHeartbeatTick is the number of ticks for heartbeat of quorum members
    RaftHeartbeatTick uint32

    // RaftElectionTick is the number of ticks to elapse before followers propose a new round of leader election
    // This value should be 10x that of RaftHeartbeatTick
    RaftElectionTick uint32

Config provides values for Cluster.

type NetworkSubnetsProvider Uses

type NetworkSubnetsProvider interface {
    Subnets() ([]net.IPNet, []net.IPNet)

NetworkSubnetsProvider exposes functions for retrieving the subnets of networks managed by Docker, so they can be filtered.



Package cluster imports 45 packages (graph) and is imported by 488 packages. Updated 2020-12-24. Refresh now. Tools for package owners.