github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/swarmkit/api/objects.proto (about)

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