objects.proto 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. syntax = "proto3";
  2. package docker.swarmkit.v1;
  3. import "github.com/docker/swarmkit/api/types.proto";
  4. import "github.com/docker/swarmkit/api/specs.proto";
  5. import "google/protobuf/timestamp.proto";
  6. import "gogoproto/gogo.proto";
  7. import "google/protobuf/any.proto";
  8. import "github.com/docker/swarmkit/protobuf/plugin/plugin.proto";
  9. // This file contains definitions for all first-class objects in the cluster
  10. // API. Such types typically have a corresponding specification, with the
  11. // naming XXXSpec, but not all.
  12. // Meta contains metadata about objects. Every object contains a meta field.
  13. message Meta {
  14. // Version tracks the current version of the object.
  15. Version version = 1 [(gogoproto.nullable) = false];
  16. // Object timestamps.
  17. // Note: can't use stdtime because these fields are nullable.
  18. google.protobuf.Timestamp created_at = 2;
  19. google.protobuf.Timestamp updated_at = 3;
  20. }
  21. // Node provides the internal node state as seen by the cluster.
  22. message Node {
  23. option (docker.protobuf.plugin.store_object) = {
  24. watch_selectors: {
  25. id: true
  26. id_prefix: true
  27. name: true
  28. name_prefix: true
  29. custom: true
  30. custom_prefix: true
  31. role: true
  32. membership: true
  33. }
  34. };
  35. // ID specifies the identity of the node.
  36. string id = 1;
  37. Meta meta = 2 [(gogoproto.nullable) = false];
  38. // Spec defines the desired state of the node as specified by the user.
  39. // The system will honor this and will *never* modify it.
  40. NodeSpec spec = 3 [(gogoproto.nullable) = false];
  41. // Description encapsulated the properties of the Node as reported by the
  42. // agent.
  43. NodeDescription description = 4;
  44. // Status provides the current status of the node, as seen by the manager.
  45. NodeStatus status = 5 [(gogoproto.nullable) = false];
  46. // ManagerStatus provides the current status of the node's manager
  47. // component, if the node is a manager.
  48. ManagerStatus manager_status = 6;
  49. // DEPRECATED: Use lb_attachments to find the ingress network
  50. // The node attachment to the ingress network.
  51. NetworkAttachment attachment = 7 [deprecated=true];
  52. // Certificate is the TLS certificate issued for the node, if any.
  53. Certificate certificate = 8 [(gogoproto.nullable) = false];
  54. // Role is the *observed* role for this node. It differs from the
  55. // desired role set in Node.Spec.Role because the role here is only
  56. // updated after the Raft member list has been reconciled with the
  57. // desired role from the spec.
  58. //
  59. // This field represents the current reconciled state. If an action is
  60. // to be performed, first verify the role in the cert. This field only
  61. // shows the privilege level that the CA would currently grant when
  62. // issuing or renewing the node's certificate.
  63. NodeRole role = 9;
  64. // Attachments enumerates the network attachments for the node to set up an
  65. // endpoint on the node to be used for load balancing. Each overlay
  66. // network, including ingress network, will have an NetworkAttachment.
  67. repeated NetworkAttachment attachments = 10;
  68. }
  69. message Service {
  70. option (docker.protobuf.plugin.store_object) = {
  71. watch_selectors: {
  72. id: true
  73. id_prefix: true
  74. name: true
  75. name_prefix: true
  76. custom: true
  77. custom_prefix: true
  78. }
  79. };
  80. string id = 1;
  81. Meta meta = 2 [(gogoproto.nullable) = false];
  82. ServiceSpec spec = 3 [(gogoproto.nullable) = false];
  83. // SpecVersion versions Spec, to identify changes in the spec. Note that
  84. // this is not directly comparable to the service's Version.
  85. Version spec_version = 10;
  86. // PreviousSpec is the previous service spec that was in place before
  87. // "Spec".
  88. ServiceSpec previous_spec = 6;
  89. // PreviousSpecVersion versions PreviousSpec. Note that this is not
  90. // directly comparable to the service's Version.
  91. Version previous_spec_version = 11;
  92. // Runtime state of service endpoint. This may be different
  93. // from the spec version because the user may not have entered
  94. // the optional fields like node_port or virtual_ip and it
  95. // could be auto allocated by the system.
  96. Endpoint endpoint = 4;
  97. // UpdateStatus contains the status of an update, if one is in
  98. // progress.
  99. UpdateStatus update_status = 5;
  100. }
  101. // Endpoint specified all the network parameters required to
  102. // correctly discover and load balance a service
  103. message Endpoint {
  104. EndpointSpec spec = 1;
  105. // Runtime state of the exposed ports which may carry
  106. // auto-allocated swarm ports in addition to the user
  107. // configured information.
  108. repeated PortConfig ports = 2;
  109. // An endpoint attachment specifies the data that the process
  110. // of attaching an endpoint to a network creates.
  111. // VirtualIP specifies a set of networks this endpoint will be attached to
  112. // and the IP addresses the target service will be made available under.
  113. message VirtualIP {
  114. // NetworkID for which this endpoint attachment was created.
  115. string network_id = 1;
  116. // A virtual IP is used to address this service in IP
  117. // layer that the client can use to send requests to
  118. // this service. A DNS A/AAAA query on the service
  119. // name might return this IP to the client. This is
  120. // strictly a logical IP and there may not be any
  121. // interfaces assigned this IP address or any route
  122. // created for this address. More than one to
  123. // accommodate for both IPv4 and IPv6
  124. string addr = 2;
  125. }
  126. // VirtualIPs specifies the IP addresses under which this endpoint will be
  127. // made available.
  128. repeated VirtualIP virtual_ips = 3 [(gogoproto.customname) = "VirtualIPs"];
  129. }
  130. // Task specifies the parameters for implementing a Spec. A task is effectively
  131. // immutable and idempotent. Once it is dispatched to a node, it will not be
  132. // dispatched to another node.
  133. message Task {
  134. option (docker.protobuf.plugin.store_object) = {
  135. watch_selectors: {
  136. id: true
  137. id_prefix: true
  138. name: true
  139. name_prefix: true
  140. custom: true
  141. custom_prefix: true
  142. service_id: true
  143. node_id: true
  144. slot: true
  145. desired_state: true
  146. }
  147. };
  148. string id = 1;
  149. Meta meta = 2 [(gogoproto.nullable) = false];
  150. // Spec defines the desired state of the task as specified by the user.
  151. // The system will honor this and will *never* modify it.
  152. TaskSpec spec = 3 [(gogoproto.nullable) = false];
  153. // SpecVersion is copied from Service, to identify which version of the
  154. // spec this task has. Note that this is not directly comparable to the
  155. // service's Version.
  156. Version spec_version = 14;
  157. // ServiceID indicates the service under which this task is orchestrated. This
  158. // should almost always be set.
  159. string service_id = 4;
  160. // Slot is the service slot number for a task.
  161. // For example, if a replicated service has replicas = 2, there will be a
  162. // task with slot = 1, and another with slot = 2.
  163. uint64 slot = 5;
  164. // NodeID indicates the node to which the task is assigned. If this field
  165. // is empty or not set, the task is unassigned.
  166. string node_id = 6;
  167. // Annotations defines the names and labels for the runtime, as set by
  168. // the cluster manager.
  169. //
  170. // As backup, if this field has an empty name, the runtime will
  171. // allocate a unique name for the actual container.
  172. //
  173. // NOTE(stevvooe): The preserves the ability for us to making naming
  174. // decisions for tasks in orchestrator, albeit, this is left empty for now.
  175. Annotations annotations = 7 [(gogoproto.nullable) = false];
  176. // ServiceAnnotations is a direct copy of the service name and labels when
  177. // this task is created.
  178. //
  179. // Labels set here will *not* be propagated to the runtime target, such as a
  180. // container. Use labels on the runtime target for that purpose.
  181. Annotations service_annotations = 8 [(gogoproto.nullable) = false];
  182. TaskStatus status = 9 [(gogoproto.nullable) = false];
  183. // DesiredState is the target state for the task. It is set to
  184. // TaskStateRunning when a task is first created, and changed to
  185. // TaskStateShutdown if the manager wants to terminate the task. This field
  186. // is only written by the manager.
  187. TaskState desired_state = 10;
  188. // List of network attachments by the task.
  189. repeated NetworkAttachment networks = 11;
  190. // A copy of runtime state of service endpoint from Service
  191. // object to be distributed to agents as part of the task.
  192. Endpoint endpoint = 12;
  193. // LogDriver specifies the selected log driver to use for the task. Agent
  194. // processes should always favor the value in this field.
  195. //
  196. // If present in the TaskSpec, this will be a copy of that value. The
  197. // orchestrator may choose to insert a value here, which should be honored,
  198. // such a cluster default or policy-based value.
  199. //
  200. // If not present, the daemon's default will be used.
  201. Driver log_driver = 13;
  202. repeated GenericResource assigned_generic_resources = 15;
  203. }
  204. // NetworkAttachment specifies the network parameters of attachment to
  205. // a single network by an object such as task or node.
  206. message NetworkAttachment {
  207. // Network state as a whole becomes part of the object so that
  208. // it always is available for use in agents so that agents
  209. // don't have any other dependency during execution.
  210. Network network = 1;
  211. // List of IPv4/IPv6 addresses that are assigned to the object
  212. // as part of getting attached to this network.
  213. repeated string addresses = 2;
  214. // List of aliases by which a task is resolved in a network
  215. repeated string aliases = 3;
  216. // Map of all the driver attachment options for this network
  217. map<string,string> driver_attachment_opts = 4;
  218. }
  219. message Network {
  220. option (docker.protobuf.plugin.store_object) = {
  221. watch_selectors: {
  222. id: true
  223. id_prefix: true
  224. name: true
  225. name_prefix: true
  226. custom: true
  227. custom_prefix: true
  228. }
  229. };
  230. string id = 1;
  231. Meta meta = 2 [(gogoproto.nullable) = false];
  232. NetworkSpec spec = 3 [(gogoproto.nullable) = false];
  233. // Driver specific operational state provided by the network driver.
  234. Driver driver_state = 4;
  235. // Runtime state of IPAM options. This may not reflect the
  236. // ipam options from NetworkSpec.
  237. IPAMOptions ipam = 5 [(gogoproto.customname) = "IPAM"];
  238. }
  239. // Cluster provides global cluster settings.
  240. message Cluster {
  241. option (docker.protobuf.plugin.store_object) = {
  242. watch_selectors: {
  243. id: true
  244. id_prefix: true
  245. name: true
  246. name_prefix: true
  247. custom: true
  248. custom_prefix: true
  249. }
  250. };
  251. string id = 1;
  252. Meta meta = 2 [(gogoproto.nullable) = false];
  253. ClusterSpec spec = 3 [(gogoproto.nullable) = false];
  254. // RootCA contains key material for the root CA.
  255. RootCA root_ca = 4 [(gogoproto.nullable)=false, (gogoproto.customname) = "RootCA"];
  256. // Symmetric encryption key distributed by the lead manager. Used by agents
  257. // for securing network bootstrapping and communication.
  258. repeated EncryptionKey network_bootstrap_keys = 5;
  259. // Logical clock used to timestamp every key. It allows other managers
  260. // and agents to unambiguously identify the older key to be deleted when
  261. // a new key is allocated on key rotation.
  262. uint64 encryption_key_lamport_clock = 6;
  263. // BlacklistedCertificates tracks certificates that should no longer
  264. // be honored. It's a mapping from CN -> BlacklistedCertificate.
  265. // swarm. Their certificates should effectively be blacklisted.
  266. map<string, BlacklistedCertificate> blacklisted_certificates = 8;
  267. // UnlockKeys defines the keys that lock node data at rest. For example,
  268. // this would contain the key encrypting key (KEK) that will encrypt the
  269. // manager TLS keys at rest and the raft encryption keys at rest.
  270. // If the key is empty, the node will be unlocked (will not require a key
  271. // to start up from a shut down state).
  272. repeated EncryptionKey unlock_keys = 9;
  273. }
  274. // Secret represents a secret that should be passed to a container or a node,
  275. // and is immutable.
  276. message Secret {
  277. option (docker.protobuf.plugin.store_object) = {
  278. watch_selectors: {
  279. id: true
  280. id_prefix: true
  281. name: true
  282. name_prefix: true
  283. custom: true
  284. custom_prefix: true
  285. }
  286. };
  287. string id = 1;
  288. Meta meta = 2 [(gogoproto.nullable) = false];
  289. // Spec contains the actual secret data, as well as any context around the
  290. // secret data that the user provides.
  291. SecretSpec spec = 3 [(gogoproto.nullable) = false];
  292. // Whether the secret is an internal secret (not set by a user) or not.
  293. bool internal = 4;
  294. }
  295. // Config represents a set of configuration files that should be passed to a
  296. // container.
  297. message Config {
  298. option (docker.protobuf.plugin.store_object) = {
  299. watch_selectors: {
  300. id: true
  301. id_prefix: true
  302. name: true
  303. name_prefix: true
  304. custom: true
  305. custom_prefix: true
  306. }
  307. };
  308. string id = 1;
  309. Meta meta = 2 [(gogoproto.nullable) = false];
  310. // Spec contains the actual config data, as well as any context around the
  311. // config data that the user provides.
  312. ConfigSpec spec = 3 [(gogoproto.nullable) = false];
  313. }
  314. // Resource is a top-level object with externally defined content and indexing.
  315. // SwarmKit can serve as a store for these objects without understanding their
  316. // meanings.
  317. message Resource {
  318. option (docker.protobuf.plugin.store_object) = {
  319. watch_selectors: {
  320. id: true
  321. id_prefix: true
  322. name: true
  323. name_prefix: true
  324. custom: true
  325. custom_prefix: true
  326. kind: true
  327. }
  328. };
  329. string id = 1 [(gogoproto.customname) = "ID"];
  330. Meta meta = 2 [(gogoproto.nullable) = false];
  331. Annotations annotations = 3 [(gogoproto.nullable) = false];
  332. // Kind identifies this class of object. It is essentially a namespace
  333. // to keep IDs or indices from colliding between unrelated Resource
  334. // objects. This must correspond to the name of an Extension.
  335. string kind = 4;
  336. // Payload bytes. This data is not interpreted in any way by SwarmKit.
  337. // By convention, it should be a marshalled protocol buffers message.
  338. google.protobuf.Any payload = 5;
  339. }
  340. // Extension declares a type of "resource" object. This message provides some
  341. // metadata about the objects.
  342. message Extension {
  343. option (docker.protobuf.plugin.store_object) = {
  344. watch_selectors: {
  345. id: true
  346. id_prefix: true
  347. name: true
  348. name_prefix: true
  349. custom: true
  350. custom_prefix: true
  351. }
  352. };
  353. string id = 1 [(gogoproto.customname) = "ID"];
  354. Meta meta = 2 [(gogoproto.nullable) = false];
  355. Annotations annotations = 3 [(gogoproto.nullable) = false];
  356. string description = 4;
  357. // TODO(aaronl): Add optional indexing capabilities. It would be
  358. // extremely useful be able to automatically introspect protobuf, json,
  359. // etc. objects and automatically index them based on a schema and field
  360. // paths defined here.
  361. //
  362. //oneof Schema {
  363. // google.protobuf.Descriptor protobuf = 1;
  364. // bytes json = 2;
  365. //}
  366. //
  367. //Schema schema = 5;
  368. //
  369. // // Indices, with values expressed as Go templates.
  370. //repeated IndexEntry index_templates = 6;
  371. }