|
| 1 | +# Nomenclature |
| 2 | + |
| 3 | +To keep track of the various software components in Swarm, this document |
| 4 | +defines various aspects of the Swarm system, as referenced in this code base. |
| 5 | + |
| 6 | +Several of these definitions may be a part of the product, while others are |
| 7 | +simply for communicating about backend components. Where this distinction is |
| 8 | +important, it will be called out. |
| 9 | + |
| 10 | +## Overview |
| 11 | + |
| 12 | +There are several moving parts in a swarm cluster. This section attempts to |
| 13 | +define the high-level aspects that can provide context to the specifics. |
| 14 | + |
| 15 | +To begin, we'll define the concept of a _cluster_. |
| 16 | + |
| 17 | +### Cluster |
| 18 | + |
| 19 | +A _Cluster_ is made up of an organized set of Docker engines configured in a |
| 20 | +manner to allow the dispatch of _services_. |
| 21 | + |
| 22 | +### Node |
| 23 | + |
| 24 | +A _Node_ refers to an active member in a cluster. Nodes can execute work and |
| 25 | +act as a cluster manager. |
| 26 | + |
| 27 | +### Manager |
| 28 | + |
| 29 | +A manager accepts _services_ defined by users through the Cluster API. When a |
| 30 | +valid _service_ is provided, the manager will generate tasks, allocate resources |
| 31 | +and dispatch _tasks_ to an available _node_. |
| 32 | + |
| 33 | +_Managers_ operate in a coordinated group, organized via the Raft protocol. |
| 34 | +When quorum is available, a leader will be elected to handle all API requests. |
| 35 | + |
| 36 | +#### Orchestrator |
| 37 | + |
| 38 | +The _Orchestrator_ ensures that services have the appropriate set of tasks |
| 39 | +running in the cluster, according the service configuration and polices. |
| 40 | + |
| 41 | +#### Allocator |
| 42 | + |
| 43 | +The allocator allocates resources, such as volumes and networks to tasks, as required. |
| 44 | + |
| 45 | +#### Scheduler |
| 46 | + |
| 47 | +The _scheduler_ assigns to tasks to available nodes. |
| 48 | + |
| 49 | +#### Dispatcher |
| 50 | + |
| 51 | +The _Dispatcher_ directly handles all agent connections. This includes |
| 52 | +registration, session management, and notification of task assignment. |
| 53 | + |
| 54 | +### Worker |
| 55 | + |
| 56 | +A _Worker_ is a complete engine joined to a _cluster_. It receives and executes |
| 57 | +_tasks_ while reporting on their status. _Tasks_ include definitions of |
| 58 | +container runtimes. |
| 59 | + |
| 60 | +A worker's _agent_ coordinates the receipt of task assignments and ensures status |
| 61 | +is correctly reported to a _dispatcher_. |
| 62 | + |
| 63 | +#### Engine |
| 64 | + |
| 65 | +The _engine_ is shorthand for the _Docker Engine_. It runs containers |
| 66 | +distributed via _tasks_. |
| 67 | + |
| 68 | +#### Agent |
| 69 | + |
| 70 | +The _agent_ coordinates the dispatch of work for a _worker_. The _agent_ |
| 71 | +maintains a connection to the _dispatcher_, waiting for the current set of |
| 72 | +tasks assigned to the node. Assigned tasks are then dispatched to the engine. |
| 73 | +The agent notifies the _dispatcher_ of the current state of assigned tasks. |
| 74 | + |
| 75 | +This is roughly analagous to an entertainment agent. It ensures the worker has |
| 76 | +the correct set of work and let's others know what the worker is doing. |
| 77 | + |
| 78 | +While we refer to cluster engines as a "worker", the term _agent_ encompasses |
| 79 | +only the component of a worker that communicates with the dispatcher. |
| 80 | + |
| 81 | +## Objects |
| 82 | + |
| 83 | +An _Object_ is any configuration component accessed as a top-level component. |
| 84 | +These typically include a set of API to introspect objects and manipulate them |
| 85 | +through a _Spec_. |
| 86 | + |
| 87 | +_Objects_ are typically broken up into a _Spec_ component and a set of fields |
| 88 | +to keep track of the implementation of the Spec. The _Spec_ represents the |
| 89 | +users intent. When a user wants to modify an object, only the Spec portion is |
| 90 | +provided. When an object flows through the system, the Spec portion is left |
| 91 | +untouched by all cluster components. |
| 92 | + |
| 93 | +Examples of objects include _Service_, _Task_, _Network_ and _Volume_. |
| 94 | + |
| 95 | +### Service |
| 96 | + |
| 97 | +The _Service_ instructs the cluster on what needs to be run. It is the central |
| 98 | +structure of the cluster system and the primary root of user interaction. The |
| 99 | +service informs the orchestrator about how to create and manage tasks. |
| 100 | + |
| 101 | +A _Service_ is configured and updated with changes to `ServiceSpec`. The |
| 102 | +central structure of the spec is a `RuntimeSpec`, consisting of definitions on |
| 103 | +how to run a container, including attachments to volumes and networks. |
| 104 | + |
| 105 | +### Task |
| 106 | + |
| 107 | +A _Task_ represents a unit of work assigned to a node. A task carries a runtime |
| 108 | +definition, describing how to run the container. |
| 109 | + |
| 110 | +As a task flows through the system, its state is updated accordingly. The state |
| 111 | +of a task only increases monotonically, meaning that once the task has failed, |
| 112 | +it must be recreated to retry. |
| 113 | + |
| 114 | +The assignment of a task to a node is immutable. Once a the task is bound to a |
| 115 | +node, it can only run on that node or fail. |
| 116 | + |
| 117 | +### Volume |
| 118 | +### Network |
| 119 | + |
0 commit comments