objects.proto 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. syntax = "proto3";
  2. package docker.swarmkit.v1;
  3. import "types.proto";
  4. import "specs.proto";
  5. import "google/protobuf/timestamp.proto";
  6. import "gogoproto/gogo.proto";
  7. // This file contains definitions for all first-class objects in the cluster
  8. // API. Such types typically have a corresponding specification, with the
  9. // naming XXXSpec, but not all.
  10. // Meta contains metadata about objects. Every object contains a meta field.
  11. message Meta {
  12. // Version tracks the current version of the object.
  13. Version version = 1 [(gogoproto.nullable) = false];
  14. // Object timestamps.
  15. // Note: can't use stdtime because these fields are nullable.
  16. google.protobuf.Timestamp created_at = 2;
  17. google.protobuf.Timestamp updated_at = 3;
  18. }
  19. // Node provides the internal node state as seen by the cluster.
  20. message Node {
  21. // ID specifies the identity of the node.
  22. string id = 1;
  23. Meta meta = 2 [(gogoproto.nullable) = false];
  24. // Spec defines the desired state of the node as specified by the user.
  25. // The system will honor this and will *never* modify it.
  26. NodeSpec spec = 3 [(gogoproto.nullable) = false];
  27. // Description encapsulated the properties of the Node as reported by the
  28. // agent.
  29. NodeDescription description = 4;
  30. // Status provides the current status of the node, as seen by the manager.
  31. NodeStatus status = 5 [(gogoproto.nullable) = false];
  32. // ManagerStatus provides the current status of the node's manager
  33. // component, if the node is a manager.
  34. ManagerStatus manager_status = 6;
  35. // The node attachment to the ingress network.
  36. NetworkAttachment attachment = 7;
  37. // Certificate is the TLS certificate issued for the node, if any.
  38. Certificate certificate = 8 [(gogoproto.nullable) = false];
  39. // Role is the *observed* role for this node. It differs from the
  40. // desired role set in Node.Spec.Role because the role here is only
  41. // updated after the Raft member list has been reconciled with the
  42. // desired role from the spec.
  43. //
  44. // This field represents the current reconciled state. If an action is
  45. // to be performed, first verify the role in the cert. This field only
  46. // shows the privilege level that the CA would currently grant when
  47. // issuing or renewing the node's certificate.
  48. NodeRole role = 9;
  49. }
  50. message Service {
  51. string id = 1;
  52. Meta meta = 2 [(gogoproto.nullable) = false];
  53. ServiceSpec spec = 3 [(gogoproto.nullable) = false];
  54. // PreviousSpec is the previous service spec that was in place before
  55. // "Spec".
  56. ServiceSpec previous_spec = 6;
  57. // Runtime state of service endpoint. This may be different
  58. // from the spec version because the user may not have entered
  59. // the optional fields like node_port or virtual_ip and it
  60. // could be auto allocated by the system.
  61. Endpoint endpoint = 4;
  62. // UpdateStatus contains the status of an update, if one is in
  63. // progress.
  64. UpdateStatus update_status = 5;
  65. }
  66. // Endpoint specified all the network parameters required to
  67. // correctly discover and load balance a service
  68. message Endpoint {
  69. EndpointSpec spec = 1;
  70. // Runtime state of the exposed ports which may carry
  71. // auto-allocated swarm ports in addition to the user
  72. // configured information.
  73. repeated PortConfig ports = 2;
  74. // An endpoint attachment specifies the data that the process
  75. // of attaching an endpoint to a network creates.
  76. // VirtualIP specifies a set of networks this endpoint will be attached to
  77. // and the IP addresses the target service will be made available under.
  78. message VirtualIP {
  79. // NetworkID for which this endpoint attachment was created.
  80. string network_id = 1;
  81. // A virtual IP is used to address this service in IP
  82. // layer that the client can use to send requests to
  83. // this service. A DNS A/AAAA query on the service
  84. // name might return this IP to the client. This is
  85. // strictly a logical IP and there may not be any
  86. // interfaces assigned this IP address or any route
  87. // created for this address. More than one to
  88. // accommodate for both IPv4 and IPv6
  89. string addr = 2;
  90. }
  91. // VirtualIPs specifies the IP addresses under which this endpoint will be
  92. // made available.
  93. repeated VirtualIP virtual_ips = 3 [(gogoproto.customname) = "VirtualIPs"];
  94. }
  95. // Task specifies the parameters for implementing a Spec. A task is effectively
  96. // immutable and idempotent. Once it is dispatched to a node, it will not be
  97. // dispatched to another node.
  98. message Task {
  99. string id = 1;
  100. Meta meta = 2 [(gogoproto.nullable) = false];
  101. // Spec defines the desired state of the task as specified by the user.
  102. // The system will honor this and will *never* modify it.
  103. TaskSpec spec = 3 [(gogoproto.nullable) = false];
  104. // ServiceID indicates the service under which this task is orchestrated. This
  105. // should almost always be set.
  106. string service_id = 4;
  107. // Slot is the service slot number for a task.
  108. // For example, if a replicated service has replicas = 2, there will be a
  109. // task with slot = 1, and another with slot = 2.
  110. uint64 slot = 5;
  111. // NodeID indicates the node to which the task is assigned. If this field
  112. // is empty or not set, the task is unassigned.
  113. string node_id = 6;
  114. // Annotations defines the names and labels for the runtime, as set by
  115. // the cluster manager.
  116. //
  117. // As backup, if this field has an empty name, the runtime will
  118. // allocate a unique name for the actual container.
  119. //
  120. // NOTE(stevvooe): The preserves the ability for us to making naming
  121. // decisions for tasks in orchestrator, albeit, this is left empty for now.
  122. Annotations annotations = 7 [(gogoproto.nullable) = false];
  123. // ServiceAnnotations is a direct copy of the service name and labels when
  124. // this task is created.
  125. //
  126. // Labels set here will *not* be propagated to the runtime target, such as a
  127. // container. Use labels on the runtime target for that purpose.
  128. Annotations service_annotations = 8 [(gogoproto.nullable) = false];
  129. TaskStatus status = 9 [(gogoproto.nullable) = false];
  130. // DesiredState is the target state for the task. It is set to
  131. // TaskStateRunning when a task is first created, and changed to
  132. // TaskStateShutdown if the manager wants to terminate the task. This field
  133. // is only written by the manager.
  134. TaskState desired_state = 10;
  135. // List of network attachments by the task.
  136. repeated NetworkAttachment networks = 11;
  137. // A copy of runtime state of service endpoint from Service
  138. // object to be distributed to agents as part of the task.
  139. Endpoint endpoint = 12;
  140. // LogDriver specifies the selected log driver to use for the task. Agent
  141. // processes should always favor the value in this field.
  142. //
  143. // If present in the TaskSpec, this will be a copy of that value. The
  144. // orchestrator may choose to insert a value here, which should be honored,
  145. // such a cluster default or policy-based value.
  146. //
  147. // If not present, the daemon's default will be used.
  148. Driver log_driver = 13;
  149. }
  150. // NetworkAttachment specifies the network parameters of attachment to
  151. // a single network by an object such as task or node.
  152. message NetworkAttachment {
  153. // Network state as a whole becomes part of the object so that
  154. // it always is available for use in agents so that agents
  155. // don't have any other dependency during execution.
  156. Network network = 1;
  157. // List of IPv4/IPv6 addresses that are assigned to the object
  158. // as part of getting attached to this network.
  159. repeated string addresses = 2;
  160. // List of aliases by which a task is resolved in a network
  161. repeated string aliases = 3;
  162. }
  163. message Network {
  164. string id = 1;
  165. Meta meta = 2 [(gogoproto.nullable) = false];
  166. NetworkSpec spec = 3 [(gogoproto.nullable) = false];
  167. // Driver specific operational state provided by the network driver.
  168. Driver driver_state = 4;
  169. // Runtime state of IPAM options. This may not reflect the
  170. // ipam options from NetworkSpec.
  171. IPAMOptions ipam = 5 [(gogoproto.customname) = "IPAM"];
  172. }
  173. // Cluster provides global cluster settings.
  174. message Cluster {
  175. string id = 1;
  176. Meta meta = 2 [(gogoproto.nullable) = false];
  177. ClusterSpec spec = 3 [(gogoproto.nullable) = false];
  178. // RootCA contains key material for the root CA.
  179. RootCA root_ca = 4 [(gogoproto.nullable)=false, (gogoproto.customname) = "RootCA"];
  180. // Symmetric encryption key distributed by the lead manager. Used by agents
  181. // for securing network bootstrapping and communication.
  182. repeated EncryptionKey network_bootstrap_keys = 5;
  183. // Logical clock used to timestamp every key. It allows other managers
  184. // and agents to unambiguously identify the older key to be deleted when
  185. // a new key is allocated on key rotation.
  186. uint64 encryption_key_lamport_clock = 6;
  187. // BlacklistedCertificates tracks certificates that should no longer
  188. // be honored. It's a mapping from CN -> BlacklistedCertificate.
  189. // swarm. Their certificates should effectively be blacklisted.
  190. map<string, BlacklistedCertificate> blacklisted_certificates = 8;
  191. // UnlockKeys defines the keys that lock node data at rest. For example,
  192. // this would contain the key encrypting key (KEK) that will encrypt the
  193. // manager TLS keys at rest and the raft encryption keys at rest.
  194. // If the key is empty, the node will be unlocked (will not require a key
  195. // to start up from a shut down state).
  196. repeated EncryptionKey unlock_keys = 9;
  197. }
  198. // Secret represents a secret that should be passed to a container or a node,
  199. // and is immutable. It wraps the `spec` provided by the user with useful
  200. // information that is generated from the secret data in the `spec`, such as
  201. // the digest and size of the secret data.
  202. message Secret {
  203. string id = 1;
  204. Meta meta = 2 [(gogoproto.nullable) = false];
  205. // Spec contains the actual secret data, as well as any context around the
  206. // secret data that the user provides.
  207. SecretSpec spec = 3 [(gogoproto.nullable) = false];
  208. // Whether the secret is an internal secret (not set by a user) or not.
  209. bool internal = 4;
  210. }