github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/swarmkit/api/types.proto (about) 1 syntax = "proto3"; 2 3 package docker.swarmkit.v1; 4 5 import "google/protobuf/timestamp.proto"; 6 import "google/protobuf/duration.proto"; 7 import "google/protobuf/wrappers.proto"; 8 import "gogoproto/gogo.proto"; 9 10 // This file contains types that are common to objects and spec or that are not 11 // considered first-class within the cluster object-model. 12 13 // Version tracks the last time an object in the store was updated. 14 message Version { 15 uint64 index = 1; 16 } 17 18 message IndexEntry { 19 string key = 1; 20 string val = 2; 21 } 22 23 // Annotations provide useful information to identify API objects. They are 24 // common to all API specs. 25 message Annotations { 26 string name = 1; 27 map<string, string> labels = 2; 28 29 // Indices provides keys and values for indexing this object. 30 // A single key may have multiple values. 31 repeated IndexEntry indices = 4 [(gogoproto.nullable) = false]; 32 } 33 34 // NamedGenericResource represents a "user defined" resource which is defined 35 // as a string. 36 // "Kind" is used to describe the Kind of a resource (e.g: "GPU", "FPGA", "SSD", ...) 37 // Value is used to identify the resource (GPU="UUID-1", FPGA="/dev/sdb5", ...) 38 message NamedGenericResource { 39 string kind = 1; 40 string value = 2; 41 } 42 43 // DiscreteGenericResource represents a "user defined" resource which is defined 44 // as an integer 45 // "Kind" is used to describe the Kind of a resource (e.g: "GPU", "FPGA", "SSD", ...) 46 // Value is used to count the resource (SSD=5, HDD=3, ...) 47 message DiscreteGenericResource { 48 string kind = 1; 49 int64 value = 2; 50 } 51 52 // GenericResource represents a "user defined" resource which can 53 // be either an integer (e.g: SSD=3) or a string (e.g: SSD=sda1) 54 message GenericResource { 55 oneof resource { 56 NamedGenericResource named_resource_spec = 1; 57 DiscreteGenericResource discrete_resource_spec = 2; 58 } 59 } 60 61 enum ResourceType { 62 TASK = 0; 63 SECRET = 1; 64 CONFIG = 2; 65 } 66 67 message Resources { 68 // Amount of CPUs (e.g. 2000000000 = 2 CPU cores) 69 int64 nano_cpus = 1 [(gogoproto.customname) = "NanoCPUs"]; 70 71 // Amount of memory in bytes. 72 int64 memory_bytes = 2; 73 74 // User specified resource (e.g: bananas=2;apple={red,yellow,green}) 75 repeated GenericResource generic = 3; 76 } 77 78 message ResourceRequirements { 79 Resources limits = 1; 80 Resources reservations = 2; 81 82 // Amount of swap in bytes - can only be used together with a memory limit 83 // -1 means unlimited 84 // a null pointer indicates that the default behaviour of granting twice 85 // the memory is maintained 86 google.protobuf.Int64Value swap_bytes = 3; 87 88 // Tune container memory swappiness (0 to 100) - if not specified, defaults 89 // to the container OS's default - generally 60, or the value predefined in 90 // the image; set to -1 to unset a previously set value 91 google.protobuf.Int64Value memory_swappiness = 4; 92 } 93 94 message Platform { 95 // Architecture (e.g. x86_64) 96 string architecture = 1; 97 98 // Operating System (e.g. linux) 99 string os = 2 [(gogoproto.customname) = "OS"]; 100 } 101 102 // PluginDescription describes an engine plugin. 103 message PluginDescription { 104 // Type of plugin. Canonical values for existing types are 105 // Volume, Network, and Authorization. More types could be 106 // supported in the future. 107 string type = 1; 108 109 // Name of the plugin 110 string name = 2; 111 } 112 113 message EngineDescription { 114 // Docker daemon version running on the node. 115 string engine_version = 1; 116 117 // Labels attached to the engine. 118 map<string, string> labels = 2; 119 120 // Volume, Network, and Auth plugins 121 repeated PluginDescription plugins = 3 [(gogoproto.nullable) = false]; 122 } 123 124 message NodeDescription { 125 // Hostname of the node as reported by the agent. 126 // This is different from spec.meta.name which is user-defined. 127 string hostname = 1; 128 129 // Platform of the node. 130 Platform platform = 2; 131 132 // Total resources on the node. 133 Resources resources = 3; 134 135 // Information about the Docker Engine on the node. 136 EngineDescription engine = 4; 137 138 // Information on the node's TLS setup 139 NodeTLSInfo tls_info = 5 [(gogoproto.customname) = "TLSInfo"]; 140 141 // FIPS indicates whether the node has FIPS-enabled 142 bool fips = 6 [(gogoproto.customname) = "FIPS"]; 143 } 144 145 message NodeTLSInfo { 146 // Information about which root certs the node trusts 147 bytes trust_root = 1; 148 149 // Information about the node's current TLS certificate 150 bytes cert_issuer_subject = 2; 151 bytes cert_issuer_public_key = 3; 152 } 153 154 message RaftMemberStatus { 155 bool leader = 1; 156 157 enum Reachability { 158 // Unknown indicates that the manager state cannot be resolved 159 UNKNOWN = 0; 160 161 // Unreachable indicates that the node cannot be contacted by other 162 // raft cluster members. 163 UNREACHABLE = 1; 164 165 // Reachable indicates that the node is healthy and reachable 166 // by other members. 167 REACHABLE = 2; 168 } 169 170 Reachability reachability = 2; 171 string message = 3; 172 } 173 174 message NodeStatus { 175 // TODO(aluzzardi) These should be using `gogoproto.enumvalue_customname`. 176 enum State { 177 // Unknown indicates the node state cannot be resolved. 178 UNKNOWN = 0; 179 180 // Down indicates the node is down. 181 DOWN = 1; 182 183 // Ready indicates the node is ready to accept tasks. 184 READY = 2; 185 186 // Disconnected indicates the node is currently trying to find new manager. 187 DISCONNECTED = 3; 188 } 189 190 State state = 1; 191 string message = 2; 192 // Addr is the node's IP address as observed by the manager 193 string addr = 3; 194 } 195 196 message Image { 197 // reference is a docker image reference. This can include a rpository, tag 198 // or be fully qualified witha digest. The format is specified in the 199 // distribution/reference package. 200 string reference = 1; 201 } 202 203 // Mount describes volume mounts for a container. 204 // 205 // The Mount type follows the structure of the mount syscall, including a type, 206 // source, target. Top-level flags, such as writable, are common to all kinds 207 // of mounts, where we also provide options that are specific to a type of 208 // mount. This corresponds to flags and data, respectively, in the syscall. 209 message Mount { 210 enum Type { 211 option (gogoproto.goproto_enum_prefix) = false; 212 option (gogoproto.enum_customname) = "MountType"; 213 214 BIND = 0 [(gogoproto.enumvalue_customname) = "MountTypeBind"]; // Bind mount host dir 215 VOLUME = 1 [(gogoproto.enumvalue_customname) = "MountTypeVolume"]; // Remote storage volumes 216 TMPFS = 2 [(gogoproto.enumvalue_customname) = "MountTypeTmpfs"]; // Mount a tmpfs 217 NPIPE = 3 [(gogoproto.enumvalue_customname) = "MountTypeNamedPipe"]; // Windows named pipes 218 } 219 220 // Type defines the nature of the mount. 221 Type type = 1; 222 223 // Source specifies the name of the mount. Depending on mount type, this 224 // may be a volume name or a host path, or even ignored. 225 string source = 2; 226 227 // Target path in container 228 string target = 3; 229 230 // ReadOnly should be set to true if the mount should not be writable. 231 bool readonly = 4 [(gogoproto.customname) = "ReadOnly"]; 232 233 // Consistency indicates the tolerable level of file system consistency 234 enum Consistency { 235 option (gogoproto.goproto_enum_prefix) = false; 236 option (gogoproto.enum_customname) = "MountConsistency"; 237 238 DEFAULT = 0 [(gogoproto.enumvalue_customname) = "MountConsistencyDefault"]; 239 CONSISTENT = 1 [(gogoproto.enumvalue_customname) = "MountConsistencyFull"]; 240 CACHED = 2 [(gogoproto.enumvalue_customname) = "MountConsistencyCached"]; 241 DELEGATED = 3 [(gogoproto.enumvalue_customname) = "MountConsistencyDelegated"]; 242 } 243 Consistency consistency = 8; 244 245 // BindOptions specifies options that are specific to a bind mount. 246 message BindOptions { 247 enum Propagation { 248 option (gogoproto.goproto_enum_prefix) = false; 249 option (gogoproto.enum_customname) = "MountPropagation"; 250 251 RPRIVATE = 0 [(gogoproto.enumvalue_customname) = "MountPropagationRPrivate"]; 252 PRIVATE = 1 [(gogoproto.enumvalue_customname) = "MountPropagationPrivate"]; 253 RSHARED = 2 [(gogoproto.enumvalue_customname) = "MountPropagationRShared"]; 254 SHARED = 3 [(gogoproto.enumvalue_customname) = "MountPropagationShared"]; 255 RSLAVE = 4 [(gogoproto.enumvalue_customname) = "MountPropagationRSlave"]; 256 SLAVE = 5 [(gogoproto.enumvalue_customname) = "MountPropagationSlave"]; 257 } 258 259 // Propagation mode of mount. 260 Propagation propagation = 1; 261 // allows non-recursive bind-mount, i.e. mount(2) with "bind" rather than "rbind". 262 bool nonrecursive = 2 [(gogoproto.customname) = "NonRecursive"]; 263 } 264 265 // VolumeOptions contains parameters for mounting the volume. 266 message VolumeOptions { 267 // nocopy prevents automatic copying of data to the volume with data from target 268 bool nocopy = 1 [(gogoproto.customname) = "NoCopy"]; 269 270 // labels to apply to the volume if creating 271 map<string, string> labels = 2; 272 273 // DriverConfig specifies the options that may be passed to the driver 274 // if the volume is created. 275 // 276 // If this is empty, no volume will be created if the volume is missing. 277 Driver driver_config = 3; 278 } 279 280 message TmpfsOptions { 281 // Size sets the size of the tmpfs, in bytes. 282 // 283 // This will be converted to an operating system specific value 284 // depending on the host. For example, on linux, it will be convered to 285 // use a 'k', 'm' or 'g' syntax. BSD, though not widely supported with 286 // docker, uses a straight byte value. 287 // 288 // Percentages are not supported. 289 int64 size_bytes = 1; 290 291 // Mode of the tmpfs upon creation 292 uint32 mode = 2 [(gogoproto.customtype) = "os.FileMode", (gogoproto.nullable) = false]; 293 294 // Options passed to tmpfs mount 295 string options = 3; 296 // TODO(stevvooe): There are several more tmpfs flags, specified in the 297 // daemon, that are accepted. Only the most basic are added for now. 298 // 299 // From docker/docker/pkg/mount/flags.go: 300 // 301 // var validFlags = map[string]bool{ 302 // "": true, 303 // "size": true, X 304 // "mode": true, X 305 // "uid": true, 306 // "gid": true, 307 // "nr_inodes": true, 308 // "nr_blocks": true, 309 // "mpol": true, 310 // } 311 // 312 // Some of these may be straightforward to add, but others, such as 313 // uid/gid have implications in a clustered system. 314 } 315 316 // Depending on type, one of bind_options or volumes_options will be set. 317 318 // BindOptions configures properties of a bind mount type. 319 // 320 // For mounts of type bind, the source must be an absolute host path. 321 BindOptions bind_options = 5; 322 323 // VolumeOptions configures the properties specific to a volume mount type. 324 // 325 // For mounts of type volume, the source will be used as the volume name. 326 VolumeOptions volume_options = 6; 327 328 // TmpfsOptions allows one to set options for mounting a temporary 329 // filesystem. 330 // 331 // The source field will be ignored when using mounts of type tmpfs. 332 TmpfsOptions tmpfs_options = 7; 333 334 // TODO(stevvooe): It be better to use a oneof field above, although the 335 // type is enough to make the decision, while being primary to the 336 // datastructure. 337 } 338 339 message RestartPolicy { 340 enum RestartCondition { 341 option (gogoproto.goproto_enum_prefix) = false; 342 option (gogoproto.enum_customname) = "RestartCondition"; 343 NONE = 0 [(gogoproto.enumvalue_customname) = "RestartOnNone"]; 344 ON_FAILURE = 1 [(gogoproto.enumvalue_customname) = "RestartOnFailure"]; 345 ANY = 2 [(gogoproto.enumvalue_customname) = "RestartOnAny"]; 346 } 347 348 RestartCondition condition = 1; 349 350 // Delay between restart attempts 351 // Note: can't use stdduration because this field needs to be nullable. 352 google.protobuf.Duration delay = 2; 353 354 // MaxAttempts is the maximum number of restarts to attempt on an 355 // instance before giving up. Ignored if 0. 356 uint64 max_attempts = 3; 357 358 // Window is the time window used to evaluate the restart policy. 359 // The time window is unbounded if this is 0. 360 // Note: can't use stdduration because this field needs to be nullable. 361 google.protobuf.Duration window = 4; 362 } 363 364 // UpdateConfig specifies the rate and policy of updates. 365 // TODO(aluzzardi): Consider making this a oneof with RollingStrategy and LockstepStrategy. 366 message UpdateConfig { 367 // Maximum number of tasks to be updated in one iteration. 368 // 0 means unlimited parallelism. 369 uint64 parallelism = 1; 370 371 // Amount of time between updates. 372 google.protobuf.Duration delay = 2 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false]; 373 374 enum FailureAction { 375 PAUSE = 0; 376 CONTINUE = 1; 377 ROLLBACK = 2; 378 } 379 380 // FailureAction is the action to take when an update failures. 381 FailureAction failure_action = 3; 382 383 // Monitor indicates how long to monitor a task for failure after it is 384 // created. If the task fails by ending up in one of the states 385 // REJECTED, COMPLETED, or FAILED, within Monitor from its creation, 386 // this counts as a failure. If it fails after Monitor, it does not 387 // count as a failure. If Monitor is unspecified, a default value will 388 // be used. 389 // Note: can't use stdduration because this field needs to be nullable. 390 google.protobuf.Duration monitor = 4; 391 392 // MaxFailureRatio is the fraction of tasks that may fail during 393 // an update before the failure action is invoked. Any task created by 394 // the current update which ends up in one of the states REJECTED, 395 // COMPLETED or FAILED within Monitor from its creation counts as a 396 // failure. The number of failures is divided by the number of tasks 397 // being updated, and if this fraction is greater than 398 // MaxFailureRatio, the failure action is invoked. 399 // 400 // If the failure action is CONTINUE, there is no effect. 401 // If the failure action is PAUSE, no more tasks will be updated until 402 // another update is started. 403 // If the failure action is ROLLBACK, the orchestrator will attempt to 404 // roll back to the previous service spec. If the MaxFailureRatio 405 // threshold is hit during the rollback, the rollback will pause. 406 float max_failure_ratio = 5; 407 408 // UpdateOrder controls the order of operations when rolling out an 409 // updated task. Either the old task is shut down before the new task 410 // is started, or the new task is started before the old task is shut 411 // down. 412 enum UpdateOrder { 413 STOP_FIRST = 0; 414 START_FIRST = 1; 415 } 416 417 UpdateOrder order = 6; 418 } 419 420 // UpdateStatus is the status of an update in progress. 421 message UpdateStatus { 422 enum UpdateState { 423 UNKNOWN = 0; 424 UPDATING = 1; 425 PAUSED = 2; 426 COMPLETED = 3; 427 ROLLBACK_STARTED = 4; 428 ROLLBACK_PAUSED = 5; // if a rollback fails 429 ROLLBACK_COMPLETED = 6; 430 } 431 432 // State is the state of this update. It indicates whether the 433 // update is in progress, completed, paused, rolling back, or 434 // finished rolling back. 435 UpdateState state = 1; 436 437 // StartedAt is the time at which the update was started. 438 // Note: can't use stdtime because this field is nullable. 439 google.protobuf.Timestamp started_at = 2; 440 441 // CompletedAt is the time at which the update completed successfully, 442 // paused, or finished rolling back. 443 // Note: can't use stdtime because this field is nullable. 444 google.protobuf.Timestamp completed_at = 3; 445 446 // TODO(aaronl): Consider adding a timestamp showing when the most 447 // recent task update took place. Currently, this is nontrivial 448 // because each service update kicks off a replacement update, so 449 // updating the service object with a timestamp at every step along 450 // the rolling update would cause the rolling update to be constantly 451 // restarted. 452 453 // Message explains how the update got into its current state. For 454 // example, if the update is paused, it will explain what is preventing 455 // the update from proceeding (typically the failure of a task to start up 456 // when OnFailure is PAUSE). 457 string message = 4; 458 } 459 460 // TaskState enumerates the states that a task progresses through within an 461 // agent. States are designed to be monotonically increasing, such that if two 462 // states are seen by a task, the greater of the new represents the true state. 463 464 // Only the manager create a NEW task, and move the task to PENDING and ASSIGNED. 465 // Afterward, the manager must rely on the agent to update the task status 466 // (pre-run: preparing, ready, starting; 467 // running; 468 // end-state: complete, shutdown, failed, rejected) 469 enum TaskState { 470 // TODO(aluzzardi): Move it back into `TaskStatus` because of the naming 471 // collisions of enums. 472 473 option (gogoproto.goproto_enum_prefix) = false; 474 option (gogoproto.enum_customname) = "TaskState"; 475 NEW = 0 [(gogoproto.enumvalue_customname)="TaskStateNew"]; 476 PENDING = 64 [(gogoproto.enumvalue_customname)="TaskStatePending"]; // waiting for scheduling decision 477 ASSIGNED = 192 [(gogoproto.enumvalue_customname)="TaskStateAssigned"]; 478 ACCEPTED = 256 [(gogoproto.enumvalue_customname)="TaskStateAccepted"]; // task has been accepted by an agent. 479 PREPARING = 320 [(gogoproto.enumvalue_customname)="TaskStatePreparing"]; 480 READY = 384 [(gogoproto.enumvalue_customname)="TaskStateReady"]; 481 STARTING = 448 [(gogoproto.enumvalue_customname)="TaskStateStarting"]; 482 RUNNING = 512 [(gogoproto.enumvalue_customname)="TaskStateRunning"]; 483 COMPLETE = 576 [(gogoproto.enumvalue_customname)="TaskStateCompleted"]; // successful completion of task (not error code, just ran) 484 SHUTDOWN = 640 [(gogoproto.enumvalue_customname)="TaskStateShutdown"]; // orchestrator requested shutdown 485 FAILED = 704 [(gogoproto.enumvalue_customname)="TaskStateFailed"]; // task execution failed with error 486 // TaskStateRejected means a task never ran, for instance if something about 487 // the environment failed (e.g. setting up a port on that node failed). 488 REJECTED = 768 [(gogoproto.enumvalue_customname)="TaskStateRejected"]; // task could not be executed here. 489 // TaskStateRemove is used to correctly handle service deletions and scale 490 // downs. This allows us to keep track of tasks that have been marked for 491 // deletion, but can't yet be removed because the agent is in the process of 492 // shutting them down. Once the agent has shut down tasks with desired state 493 // REMOVE, the task reaper is responsible for removing them. 494 REMOVE = 800 [(gogoproto.enumvalue_customname)="TaskStateRemove"]; 495 // TaskStateOrphaned is used to free up resources associated with service 496 // tasks on unresponsive nodes without having to delete those tasks. This 497 // state is directly assigned to the task by the orchestrator. 498 ORPHANED = 832 [(gogoproto.enumvalue_customname)="TaskStateOrphaned"]; 499 500 // NOTE(stevvooe): The state of a task is actually a lamport clock, in that 501 // given two observations, the greater of the two can be considered 502 // correct. To enforce this, we only allow tasks to proceed to a greater 503 // state. 504 // 505 // A byproduct of this design decision is that we must also maintain this 506 // invariant in the protobuf enum values, such that when comparing two 507 // values, the one with the greater value is also the greater state. 508 // 509 // Because we may want to add intervening states a later date, we've left 510 // 64 spaces between each one. This should allow us to make 5 or 6 511 // insertions between each state if we find that we made a mistake and need 512 // another state. 513 // 514 // Remove this message when the states are deemed perfect. 515 } 516 517 // Container specific status. 518 message ContainerStatus { 519 string container_id = 1; 520 521 int32 pid = 2 [(gogoproto.customname) = "PID"]; 522 int32 exit_code = 3; 523 } 524 525 // PortStatus specifies the actual allocated runtime state of a list 526 // of port configs. 527 message PortStatus { 528 repeated PortConfig ports = 1; 529 } 530 531 message TaskStatus { 532 // Note: can't use stdtime because this field is nullable. 533 google.protobuf.Timestamp timestamp = 1; 534 535 // State expresses the current state of the task. 536 TaskState state = 2; 537 538 // Message reports a message for the task status. This should provide a 539 // human readable message that can point to how the task actually arrived 540 // at a current state. 541 // 542 // As a convention, we place the a small message here that led to the 543 // current state. For example, if the task is in ready, because it was 544 // prepared, we'd place "prepared" in this field. If we skipped preparation 545 // because the task is prepared, we would put "already prepared" in this 546 // field. 547 string message = 3; 548 549 // Err is set if the task is in an error state, or is unable to 550 // progress from an earlier state because a precondition is 551 // unsatisfied. 552 // 553 // The following states should report a companion error: 554 // 555 // FAILED, REJECTED 556 // 557 // In general, messages that should be surfaced to users belong in the 558 // Err field, and notes on routine state transitions belong in Message. 559 // 560 // TODO(stevvooe) Integrate this field with the error interface. 561 string err = 4; 562 563 // Container status contains container specific status information. 564 oneof runtime_status { 565 ContainerStatus container = 5; 566 } 567 568 // HostPorts provides a list of ports allocated at the host 569 // level. 570 PortStatus port_status = 6; 571 572 // AppliedBy gives the node ID of the manager that applied this task 573 // status update to the Task object. 574 string applied_by = 7; 575 576 // AppliedAt gives a timestamp of when this status update was applied to 577 // the Task object. 578 // Note: can't use stdtime because this field is nullable. 579 google.protobuf.Timestamp applied_at = 8; 580 } 581 582 // NetworkAttachmentConfig specifies how a service should be attached to a particular network. 583 // 584 // For now, this is a simple struct, but this can include future information 585 // instructing Swarm on how this service should work on the particular 586 // network. 587 message NetworkAttachmentConfig { 588 // Target specifies the target network for attachment. This value must be a 589 // network ID. 590 string target = 1; 591 // Aliases specifies a list of discoverable alternate names for the service on this Target. 592 repeated string aliases = 2; 593 // Addresses specifies a list of ipv4 and ipv6 addresses 594 // preferred. If these addresses are not available then the 595 // attachment might fail. 596 repeated string addresses = 3; 597 // DriverAttachmentOpts is a map of driver attachment options for the network target 598 map<string, string> driver_attachment_opts = 4; 599 } 600 601 // IPAMConfig specifies parameters for IP Address Management. 602 message IPAMConfig { 603 // TODO(stevvooe): It may make more sense to manage IPAM and network 604 // definitions separately. This will allow multiple networks to share IPAM 605 // instances. For now, we will follow the conventions of libnetwork and 606 // specify this as part of the network specification. 607 608 // AddressFamily specifies the network address family that 609 // this IPAMConfig belongs to. 610 enum AddressFamily { 611 UNKNOWN = 0; // satisfy proto3 612 IPV4 = 4; 613 IPV6 = 6; 614 } 615 616 AddressFamily family = 1; 617 618 // Subnet defines a network as a CIDR address (ie network and mask 619 // 192.168.0.1/24). 620 string subnet = 2; 621 622 // Range defines the portion of the subnet to allocate to tasks. This is 623 // defined as a subnet within the primary subnet. 624 string range = 3; 625 626 // Gateway address within the subnet. 627 string gateway = 4; 628 629 // Reserved is a list of address from the master pool that should *not* be 630 // allocated. These addresses may have already been allocated or may be 631 // reserved for another allocation manager. 632 map<string, string> reserved = 5; 633 } 634 635 // PortConfig specifies an exposed port which can be 636 // addressed using the given name. This can be later queried 637 // using a service discovery api or a DNS SRV query. The node 638 // port specifies a port that can be used to address this 639 // service external to the cluster by sending a connection 640 // request to this port to any node on the cluster. 641 message PortConfig { 642 enum Protocol { 643 option (gogoproto.goproto_enum_prefix) = false; 644 645 TCP = 0 [(gogoproto.enumvalue_customname) = "ProtocolTCP"]; 646 UDP = 1 [(gogoproto.enumvalue_customname) = "ProtocolUDP"]; 647 SCTP = 2 [(gogoproto.enumvalue_customname) = "ProtocolSCTP"]; 648 } 649 650 // PublishMode controls how ports are published on the swarm. 651 enum PublishMode { 652 option (gogoproto.enum_customname) = "PublishMode"; 653 option (gogoproto.goproto_enum_prefix) = false; 654 655 // PublishModeIngress exposes the port across the cluster on all nodes. 656 INGRESS = 0 [(gogoproto.enumvalue_customname) = "PublishModeIngress"]; 657 658 // PublishModeHost exposes the port on just the target host. If the 659 // published port is undefined, an ephemeral port will be allocated. If 660 // the published port is defined, the node will attempt to allocate it, 661 // erroring the task if it fails. 662 HOST = 1 [(gogoproto.enumvalue_customname) = "PublishModeHost"]; 663 } 664 665 // Name for the port. If provided the port information can 666 // be queried using the name as in a DNS SRV query. 667 string name = 1; 668 669 // Protocol for the port which is exposed. 670 Protocol protocol = 2; 671 672 // The port which the application is exposing and is bound to. 673 uint32 target_port = 3; 674 675 // PublishedPort specifies the port on which the service is exposed. If 676 // specified, the port must be within the available range. If not specified 677 // (value is zero), an available port is automatically assigned. 678 uint32 published_port = 4; 679 680 // PublishMode controls how the port is published. 681 PublishMode publish_mode = 5; 682 } 683 684 // Driver is a generic driver type to be used throughout the API. For now, a 685 // driver is simply a name and set of options. The field contents depend on the 686 // target use case and driver application. For example, a network driver may 687 // have different rules than a volume driver. 688 message Driver { 689 string name = 1; 690 map <string, string> options = 2; 691 } 692 693 message IPAMOptions { 694 Driver driver = 1; 695 repeated IPAMConfig configs = 3; 696 } 697 698 // Peer should be used anywhere where we are describing a remote peer. 699 message Peer { 700 string node_id = 1; 701 string addr = 2; 702 } 703 704 // WeightedPeer should be used anywhere where we are describing a remote peer 705 // with a weight. 706 message WeightedPeer { 707 Peer peer = 1; 708 int64 weight = 2; 709 } 710 711 712 message IssuanceStatus { 713 enum State { 714 option (gogoproto.goproto_enum_prefix) = false; 715 716 UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "IssuanceStateUnknown"]; 717 // A new certificate should be issued 718 RENEW = 1 [(gogoproto.enumvalue_customname)="IssuanceStateRenew"]; 719 // Certificate is pending acceptance 720 PENDING = 2 [(gogoproto.enumvalue_customname)="IssuanceStatePending"]; 721 // successful completion certificate issuance 722 ISSUED = 3 [(gogoproto.enumvalue_customname)="IssuanceStateIssued"]; 723 // Certificate issuance failed 724 FAILED = 4 [(gogoproto.enumvalue_customname)="IssuanceStateFailed"]; 725 // Signals workers to renew their certificate. From the CA's perspective 726 // this is equivalent to IssuanceStateIssued: a noop. 727 ROTATE = 5 [(gogoproto.enumvalue_customname)="IssuanceStateRotate"]; 728 } 729 State state = 1; 730 731 // Err is set if the Certificate Issuance is in an error state. 732 // The following states should report a companion error: 733 // FAILED 734 string err = 2; 735 } 736 737 message AcceptancePolicy { 738 message RoleAdmissionPolicy { 739 message Secret { 740 // The actual content (possibly hashed) 741 bytes data = 1; 742 // The type of hash we are using, or "plaintext" 743 string alg = 2; 744 } 745 746 NodeRole role = 1; 747 // Autoaccept controls which roles' certificates are automatically 748 // issued without administrator intervention. 749 bool autoaccept = 2; 750 // Secret represents a user-provided string that is necessary for new 751 // nodes to join the cluster 752 Secret secret = 3; 753 } 754 755 repeated RoleAdmissionPolicy policies = 1; 756 } 757 758 message ExternalCA { 759 enum CAProtocol { 760 CFSSL = 0 [(gogoproto.enumvalue_customname) = "CAProtocolCFSSL"]; 761 } 762 763 // Protocol is the protocol used by this external CA. 764 CAProtocol protocol = 1; 765 766 // URL is the URL where the external CA can be reached. 767 string url = 2 [(gogoproto.customname) = "URL"]; 768 769 // Options is a set of additional key/value pairs whose interpretation 770 // depends on the specified CA type. 771 map<string, string> options = 3; 772 773 // CACert specifies which root CA is used by this external CA 774 bytes ca_cert = 4 [(gogoproto.customname) = "CACert"]; 775 } 776 777 message CAConfig { 778 // NodeCertExpiry is the duration certificates should be issued for 779 // Note: can't use stdduration because this field needs to be nullable. 780 google.protobuf.Duration node_cert_expiry = 1; 781 782 // ExternalCAs is a list of CAs to which a manager node will make 783 // certificate signing requests for node certificates. 784 repeated ExternalCA external_cas = 2 [(gogoproto.customname) = "ExternalCAs"]; 785 786 // SigningCACert is the desired CA certificate to be used as the root and 787 // signing CA for the swarm. If not provided, indicates that we are either happy 788 // with the current configuration, or (together with a bump in the ForceRotate value) 789 // that we want a certificate and key generated for us. 790 bytes signing_ca_cert = 3 [(gogoproto.customname) = "SigningCACert"]; 791 792 // SigningCAKey is the desired private key, matching the signing CA cert, to be used 793 // to sign certificates for the swarm 794 bytes signing_ca_key = 4 [(gogoproto.customname) = "SigningCAKey"]; 795 796 // ForceRotate is a counter that triggers a root CA rotation even if no relevant 797 // parameters have been in the spec. This will force the manager to generate a new 798 // certificate and key, if none have been provided. 799 uint64 force_rotate = 5; 800 } 801 802 // OrchestrationConfig defines cluster-level orchestration settings. 803 message OrchestrationConfig { 804 // TaskHistoryRetentionLimit is the number of historic tasks to keep per instance or 805 // node. If negative, never remove completed or failed tasks. 806 int64 task_history_retention_limit = 1; 807 808 } 809 810 // TaskDefaults specifies default values for task creation. 811 message TaskDefaults { 812 // LogDriver specifies the log driver to use for the cluster if not 813 // specified for each task. 814 // 815 // If this is changed, only new tasks will pick up the new log driver. 816 // Existing tasks will continue to use the previous default until rescheduled. 817 Driver log_driver = 1; 818 } 819 820 // DispatcherConfig defines cluster-level dispatcher settings. 821 message DispatcherConfig { 822 // HeartbeatPeriod defines how often agent should send heartbeats to 823 // dispatcher. 824 // Note: can't use stdduration because this field needs to be nullable. 825 google.protobuf.Duration heartbeat_period = 1; 826 } 827 828 // RaftConfig defines raft settings for the cluster. 829 message RaftConfig { 830 // SnapshotInterval is the number of log entries between snapshots. 831 uint64 snapshot_interval = 1; 832 // KeepOldSnapshots is the number of snapshots to keep beyond the 833 // current snapshot. 834 uint64 keep_old_snapshots = 2; 835 // LogEntriesForSlowFollowers is the number of log entries to keep 836 // around to sync up slow followers after a snapshot is created. 837 uint64 log_entries_for_slow_followers = 3; 838 // HeartbeatTick defines the amount of ticks (in seconds) between 839 // each heartbeat message sent to other members for health-check. 840 uint32 heartbeat_tick = 4; 841 // ElectionTick defines the amount of ticks (in seconds) needed 842 // without a leader to trigger a new election. 843 uint32 election_tick = 5; 844 } 845 846 message EncryptionConfig { 847 // AutoLockManagers specifies whether or not managers TLS keys and raft data 848 // should be encrypted at rest in such a way that they must be unlocked 849 // before the manager node starts up again. 850 bool auto_lock_managers = 1; 851 } 852 853 message SpreadOver { 854 string spread_descriptor = 1; // label descriptor, such as engine.labels.az 855 // TODO: support node information beyond engine and node labels 856 857 // TODO: in the future, add a map that provides weights for weighted 858 // spreading. 859 } 860 861 message PlacementPreference { 862 oneof Preference { 863 SpreadOver spread = 1; 864 } 865 } 866 867 // Placement specifies task distribution constraints. 868 message Placement { 869 // Constraints specifies a set of requirements a node should meet for a task. 870 repeated string constraints = 1; 871 872 // Preferences provide a way to make the scheduler aware of factors 873 // such as topology. They are provided in order from highest to lowest 874 // precedence. 875 repeated PlacementPreference preferences = 2; 876 877 // Platforms stores all the platforms that the image can run on. 878 // This field is used in the platform filter for scheduling. If empty, 879 // then the platform filter is off, meaning there are no scheduling restrictions. 880 repeated Platform platforms = 3; 881 882 // MaxReplicas specifies the limit for maximum number of replicas running on one node. 883 uint64 max_replicas = 4; 884 } 885 886 // JoinToken contains the join tokens for workers and managers. 887 message JoinTokens { 888 // Worker is the join token workers may use to join the swarm. 889 string worker = 1; 890 891 // Manager is the join token workers may use to join the swarm. 892 string manager = 2; 893 } 894 895 message RootCA { 896 // CAKey is the root CA private key. 897 bytes ca_key = 1 [(gogoproto.customname) = "CAKey"]; 898 899 // CACert is the root CA certificate. 900 bytes ca_cert = 2 [(gogoproto.customname) = "CACert"]; 901 902 // CACertHash is the digest of the CA Certificate. 903 string ca_cert_hash = 3 [(gogoproto.customname) = "CACertHash"]; 904 905 // JoinTokens contains the join tokens for workers and managers. 906 JoinTokens join_tokens = 4 [(gogoproto.nullable) = false]; 907 908 // RootRotation contains the new root cert and key we want to rotate to - if this is nil, we are not in the 909 // middle of a root rotation 910 RootRotation root_rotation = 5; 911 912 // LastForcedRotation matches the Cluster Spec's CAConfig's ForceRotation counter. 913 // It indicates when the current CA cert and key were generated (or updated). 914 uint64 last_forced_rotation = 6; 915 } 916 917 918 enum NodeRole { 919 option (gogoproto.enum_customname) = "NodeRole"; 920 option (gogoproto.goproto_enum_prefix) = false; 921 922 WORKER = 0 [(gogoproto.enumvalue_customname) = "NodeRoleWorker"]; 923 MANAGER = 1 [(gogoproto.enumvalue_customname) = "NodeRoleManager"]; 924 } 925 926 message Certificate { 927 NodeRole role = 1; 928 929 bytes csr = 2 [(gogoproto.customname) = "CSR"]; 930 931 IssuanceStatus status = 3 [(gogoproto.nullable) = false]; 932 933 bytes certificate = 4; 934 935 // CN represents the node ID. 936 string cn = 5 [(gogoproto.customname) = "CN"]; 937 } 938 939 940 // Symmetric keys to encrypt inter-agent communication. 941 message EncryptionKey { 942 // Agent subsystem the key is intended for. Example: 943 // networking:gossip 944 string subsystem = 1; 945 946 // Encryption algorithm that can implemented using this key 947 enum Algorithm { 948 option (gogoproto.goproto_enum_prefix) = false; 949 950 AES_128_GCM = 0; 951 } 952 953 Algorithm algorithm = 2; 954 955 bytes key = 3; 956 957 // Time stamp from the lamport clock of the key allocator to 958 // identify the relative age of the key. 959 uint64 lamport_time = 4; 960 } 961 962 // ManagerStatus provides informations about the state of a manager in the cluster. 963 message ManagerStatus { 964 // RaftID specifies the internal ID used by the manager in a raft context, it can never be modified 965 // and is used only for information purposes 966 uint64 raft_id = 1; 967 968 // Addr is the address advertised to raft. 969 string addr = 2; 970 971 // Leader is set to true if this node is the raft leader. 972 bool leader = 3; 973 974 // Reachability specifies whether this node is reachable. 975 RaftMemberStatus.Reachability reachability = 4; 976 } 977 978 // FileTarget represents a specific target that is backed by a file 979 message FileTarget { 980 // Name represents the final filename in the filesystem 981 string name = 1; 982 983 // UID represents the file UID 984 string uid = 2 [(gogoproto.customname) = "UID"]; 985 986 // GID represents the file GID 987 string gid = 3 [(gogoproto.customname) = "GID"]; 988 989 // Mode represents the FileMode of the file 990 uint32 mode = 4 [(gogoproto.customtype) = "os.FileMode", (gogoproto.nullable) = false]; 991 } 992 993 // RuntimeTarget represents that this secret is _not_ mounted into the 994 // container, but is used for some other purpose by the container runtime. 995 // 996 // Currently, RuntimeTarget has no fields; it's just a placeholder. 997 message RuntimeTarget {} 998 999 // SecretReference is the linkage between a service and a secret that it uses. 1000 message SecretReference { 1001 // SecretID represents the ID of the specific Secret that we're 1002 // referencing. This identifier exists so that SecretReferences don't leak 1003 // any information about the secret contents. 1004 string secret_id = 1; 1005 1006 // SecretName is the name of the secret that this references, but this is just provided for 1007 // lookup/display purposes. The secret in the reference will be identified by its ID. 1008 string secret_name = 2; 1009 1010 // Target specifies how this secret should be exposed to the task. 1011 oneof target { 1012 FileTarget file = 3; 1013 } 1014 } 1015 1016 // ConfigReference is the linkage between a service and a config that it uses. 1017 message ConfigReference { 1018 // ConfigID represents the ID of the specific Config that we're 1019 // referencing. 1020 string config_id = 1; 1021 1022 // ConfigName is the name of the config that this references, but this is just provided for 1023 // lookup/display purposes. The config in the reference will be identified by its ID. 1024 string config_name = 2; 1025 1026 // Target specifies how this config should be exposed to the task. 1027 oneof target { 1028 FileTarget file = 3; 1029 RuntimeTarget runtime = 4; 1030 } 1031 } 1032 1033 // BlacklistedCertificate is a record for a blacklisted certificate. It does not 1034 // contain the certificate's CN, because these records are indexed by CN. 1035 message BlacklistedCertificate { 1036 // Expiry is the latest known expiration time of a certificate that 1037 // was issued for the given CN. 1038 // Note: can't use stdtime because this field is nullable. 1039 google.protobuf.Timestamp expiry = 1; 1040 } 1041 1042 // HealthConfig holds configuration settings for the HEALTHCHECK feature. 1043 message HealthConfig { 1044 // Test is the test to perform to check that the container is healthy. 1045 // An empty slice means to inherit the default. 1046 // The options are: 1047 // {} : inherit healthcheck 1048 // {"NONE"} : disable healthcheck 1049 // {"CMD", args...} : exec arguments directly 1050 // {"CMD-SHELL", command} : run command with system's default shell 1051 repeated string test = 1; 1052 1053 // Interval is the time to wait between checks. Zero means inherit. 1054 // Note: can't use stdduration because this field needs to be nullable. 1055 google.protobuf.Duration interval = 2; 1056 1057 // Timeout is the time to wait before considering the check to have hung. 1058 // Zero means inherit. 1059 // Note: can't use stdduration because this field needs to be nullable. 1060 google.protobuf.Duration timeout = 3; 1061 1062 // Retries is the number of consecutive failures needed to consider a 1063 // container as unhealthy. Zero means inherit. 1064 int32 retries = 4; 1065 1066 // Start period is the period for container initialization during 1067 // which health check failures will note count towards the maximum 1068 // number of retries. 1069 google.protobuf.Duration start_period = 5; 1070 } 1071 1072 message MaybeEncryptedRecord { 1073 enum Algorithm { 1074 NONE = 0 [(gogoproto.enumvalue_customname) = "NotEncrypted"]; 1075 SECRETBOX_SALSA20_POLY1305 = 1 [(gogoproto.enumvalue_customname) = "NACLSecretboxSalsa20Poly1305"]; 1076 FERNET_AES_128_CBC = 2 [(gogoproto.enumvalue_customname) = "FernetAES128CBC"]; 1077 } 1078 1079 Algorithm algorithm = 1; 1080 bytes data = 2; 1081 bytes nonce = 3; 1082 } 1083 1084 1085 message RootRotation { 1086 bytes ca_cert = 1 [(gogoproto.customname) = "CACert"]; 1087 bytes ca_key = 2 [(gogoproto.customname) = "CAKey"]; 1088 // cross-signed CA cert is the CACert that has been cross-signed by the previous root 1089 bytes cross_signed_ca_cert = 3 [(gogoproto.customname) = "CrossSignedCACert"]; 1090 } 1091 1092 // Privileges specifies security configuration/permissions. 1093 message Privileges { 1094 // CredentialSpec for managed service account (Windows only). 1095 message CredentialSpec { 1096 oneof source { 1097 string file = 1; 1098 string registry = 2; 1099 1100 // Config represents a Config ID from which to get the CredentialSpec. 1101 // The Config MUST be included in the SecretReferences with a RuntimeTarget 1102 string config = 3; 1103 } 1104 } 1105 CredentialSpec credential_spec = 1; 1106 1107 // SELinuxContext contains the SELinux labels for the container. 1108 message SELinuxContext { 1109 bool disable = 1; 1110 1111 string user = 2; 1112 string role = 3; 1113 string type = 4; 1114 string level = 5; 1115 } 1116 SELinuxContext selinux_context = 2 [(gogoproto.customname) = "SELinuxContext"]; 1117 } 1118 1119 // JobStatus indicates the status of a Service that is in one of the Job modes. 1120 message JobStatus { 1121 // JobIteration is the count of how many times the Job has been excecuted, 1122 // successfully or otherwise. "Executed" refers to the job as a whole being 1123 // started, not to the individual Tasks being launched. This is used to 1124 // disambiguate which Tasks belong to which iteration of a Job. 1125 Version job_iteration = 1 [(gogoproto.nullable) = false]; 1126 1127 // LastExecution is the time that the job was last executed. This is set by 1128 // the orchestrator in the same transaction that JobIteration is incremented. 1129 // While time is a fungible concept in distributed systems like Swarmkit, 1130 // this value gives us a best-effort attempt to prevent weird behavior like 1131 // newly added nodes executing long-forgotten jobs. 1132 google.protobuf.Timestamp last_execution = 2; 1133 }