discovery.proto 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. syntax = "proto3";
  2. package envoy.service.discovery.v3;
  3. import "envoy/config/core/v3/base.proto";
  4. import "google/protobuf/any.proto";
  5. import "google/protobuf/duration.proto";
  6. import "google/rpc/status.proto";
  7. import "udpa/annotations/status.proto";
  8. import "udpa/annotations/versioning.proto";
  9. option java_package = "io.envoyproxy.envoy.service.discovery.v3";
  10. option java_outer_classname = "DiscoveryProto";
  11. option java_multiple_files = true;
  12. option go_package = "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3;discoveryv3";
  13. option (udpa.annotations.file_status).package_version_status = ACTIVE;
  14. // [#protodoc-title: Common discovery API components]
  15. // A DiscoveryRequest requests a set of versioned resources of the same type for
  16. // a given Envoy node on some API.
  17. // [#next-free-field: 7]
  18. message DiscoveryRequest {
  19. option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.DiscoveryRequest";
  20. // The version_info provided in the request messages will be the version_info
  21. // received with the most recent successfully processed response or empty on
  22. // the first request. It is expected that no new request is sent after a
  23. // response is received until the Envoy instance is ready to ACK/NACK the new
  24. // configuration. ACK/NACK takes place by returning the new API config version
  25. // as applied or the previous API config version respectively. Each type_url
  26. // (see below) has an independent version associated with it.
  27. string version_info = 1;
  28. // The node making the request.
  29. config.core.v3.Node node = 2;
  30. // List of resources to subscribe to, e.g. list of cluster names or a route
  31. // configuration name. If this is empty, all resources for the API are
  32. // returned. LDS/CDS may have empty resource_names, which will cause all
  33. // resources for the Envoy instance to be returned. The LDS and CDS responses
  34. // will then imply a number of resources that need to be fetched via EDS/RDS,
  35. // which will be explicitly enumerated in resource_names.
  36. repeated string resource_names = 3;
  37. // Type of the resource that is being requested, e.g.
  38. // "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment". This is implicit
  39. // in requests made via singleton xDS APIs such as CDS, LDS, etc. but is
  40. // required for ADS.
  41. string type_url = 4;
  42. // nonce corresponding to DiscoveryResponse being ACK/NACKed. See above
  43. // discussion on version_info and the DiscoveryResponse nonce comment. This
  44. // may be empty only if 1) this is a non-persistent-stream xDS such as HTTP,
  45. // or 2) the client has not yet accepted an update in this xDS stream (unlike
  46. // delta, where it is populated only for new explicit ACKs).
  47. string response_nonce = 5;
  48. // This is populated when the previous :ref:`DiscoveryResponse <envoy_v3_api_msg_service.discovery.v3.DiscoveryResponse>`
  49. // failed to update configuration. The *message* field in *error_details* provides the Envoy
  50. // internal exception related to the failure. It is only intended for consumption during manual
  51. // debugging, the string provided is not guaranteed to be stable across Envoy versions.
  52. google.rpc.Status error_detail = 6;
  53. }
  54. // [#next-free-field: 7]
  55. message DiscoveryResponse {
  56. option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.DiscoveryResponse";
  57. // The version of the response data.
  58. string version_info = 1;
  59. // The response resources. These resources are typed and depend on the API being called.
  60. repeated google.protobuf.Any resources = 2;
  61. // [#not-implemented-hide:]
  62. // Canary is used to support two Envoy command line flags:
  63. //
  64. // * --terminate-on-canary-transition-failure. When set, Envoy is able to
  65. // terminate if it detects that configuration is stuck at canary. Consider
  66. // this example sequence of updates:
  67. // - Management server applies a canary config successfully.
  68. // - Management server rolls back to a production config.
  69. // - Envoy rejects the new production config.
  70. // Since there is no sensible way to continue receiving configuration
  71. // updates, Envoy will then terminate and apply production config from a
  72. // clean slate.
  73. // * --dry-run-canary. When set, a canary response will never be applied, only
  74. // validated via a dry run.
  75. bool canary = 3;
  76. // Type URL for resources. Identifies the xDS API when muxing over ADS.
  77. // Must be consistent with the type_url in the 'resources' repeated Any (if non-empty).
  78. string type_url = 4;
  79. // For gRPC based subscriptions, the nonce provides a way to explicitly ack a
  80. // specific DiscoveryResponse in a following DiscoveryRequest. Additional
  81. // messages may have been sent by Envoy to the management server for the
  82. // previous version on the stream prior to this DiscoveryResponse, that were
  83. // unprocessed at response send time. The nonce allows the management server
  84. // to ignore any further DiscoveryRequests for the previous version until a
  85. // DiscoveryRequest bearing the nonce. The nonce is optional and is not
  86. // required for non-stream based xDS implementations.
  87. string nonce = 5;
  88. // The control plane instance that sent the response.
  89. config.core.v3.ControlPlane control_plane = 6;
  90. }
  91. // DeltaDiscoveryRequest and DeltaDiscoveryResponse are used in a new gRPC
  92. // endpoint for Delta xDS.
  93. //
  94. // With Delta xDS, the DeltaDiscoveryResponses do not need to include a full
  95. // snapshot of the tracked resources. Instead, DeltaDiscoveryResponses are a
  96. // diff to the state of a xDS client.
  97. // In Delta XDS there are per-resource versions, which allow tracking state at
  98. // the resource granularity.
  99. // An xDS Delta session is always in the context of a gRPC bidirectional
  100. // stream. This allows the xDS server to keep track of the state of xDS clients
  101. // connected to it.
  102. //
  103. // In Delta xDS the nonce field is required and used to pair
  104. // DeltaDiscoveryResponse to a DeltaDiscoveryRequest ACK or NACK.
  105. // Optionally, a response message level system_version_info is present for
  106. // debugging purposes only.
  107. //
  108. // DeltaDiscoveryRequest plays two independent roles. Any DeltaDiscoveryRequest
  109. // can be either or both of: [1] informing the server of what resources the
  110. // client has gained/lost interest in (using resource_names_subscribe and
  111. // resource_names_unsubscribe), or [2] (N)ACKing an earlier resource update from
  112. // the server (using response_nonce, with presence of error_detail making it a NACK).
  113. // Additionally, the first message (for a given type_url) of a reconnected gRPC stream
  114. // has a third role: informing the server of the resources (and their versions)
  115. // that the client already possesses, using the initial_resource_versions field.
  116. //
  117. // As with state-of-the-world, when multiple resource types are multiplexed (ADS),
  118. // all requests/acknowledgments/updates are logically walled off by type_url:
  119. // a Cluster ACK exists in a completely separate world from a prior Route NACK.
  120. // In particular, initial_resource_versions being sent at the "start" of every
  121. // gRPC stream actually entails a message for each type_url, each with its own
  122. // initial_resource_versions.
  123. // [#next-free-field: 8]
  124. message DeltaDiscoveryRequest {
  125. option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.DeltaDiscoveryRequest";
  126. // The node making the request.
  127. config.core.v3.Node node = 1;
  128. // Type of the resource that is being requested, e.g.
  129. // "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment". This does not need to be set if
  130. // resources are only referenced via *xds_resource_subscribe* and
  131. // *xds_resources_unsubscribe*.
  132. string type_url = 2;
  133. // DeltaDiscoveryRequests allow the client to add or remove individual
  134. // resources to the set of tracked resources in the context of a stream.
  135. // All resource names in the resource_names_subscribe list are added to the
  136. // set of tracked resources and all resource names in the resource_names_unsubscribe
  137. // list are removed from the set of tracked resources.
  138. //
  139. // *Unlike* state-of-the-world xDS, an empty resource_names_subscribe or
  140. // resource_names_unsubscribe list simply means that no resources are to be
  141. // added or removed to the resource list.
  142. // *Like* state-of-the-world xDS, the server must send updates for all tracked
  143. // resources, but can also send updates for resources the client has not subscribed to.
  144. //
  145. // NOTE: the server must respond with all resources listed in resource_names_subscribe,
  146. // even if it believes the client has the most recent version of them. The reason:
  147. // the client may have dropped them, but then regained interest before it had a chance
  148. // to send the unsubscribe message. See DeltaSubscriptionStateTest.RemoveThenAdd.
  149. //
  150. // These two fields can be set in any DeltaDiscoveryRequest, including ACKs
  151. // and initial_resource_versions.
  152. //
  153. // A list of Resource names to add to the list of tracked resources.
  154. repeated string resource_names_subscribe = 3;
  155. // A list of Resource names to remove from the list of tracked resources.
  156. repeated string resource_names_unsubscribe = 4;
  157. // Informs the server of the versions of the resources the xDS client knows of, to enable the
  158. // client to continue the same logical xDS session even in the face of gRPC stream reconnection.
  159. // It will not be populated: [1] in the very first stream of a session, since the client will
  160. // not yet have any resources, [2] in any message after the first in a stream (for a given
  161. // type_url), since the server will already be correctly tracking the client's state.
  162. // (In ADS, the first message *of each type_url* of a reconnected stream populates this map.)
  163. // The map's keys are names of xDS resources known to the xDS client.
  164. // The map's values are opaque resource versions.
  165. map<string, string> initial_resource_versions = 5;
  166. // When the DeltaDiscoveryRequest is a ACK or NACK message in response
  167. // to a previous DeltaDiscoveryResponse, the response_nonce must be the
  168. // nonce in the DeltaDiscoveryResponse.
  169. // Otherwise (unlike in DiscoveryRequest) response_nonce must be omitted.
  170. string response_nonce = 6;
  171. // This is populated when the previous :ref:`DiscoveryResponse <envoy_v3_api_msg_service.discovery.v3.DiscoveryResponse>`
  172. // failed to update configuration. The *message* field in *error_details*
  173. // provides the Envoy internal exception related to the failure.
  174. google.rpc.Status error_detail = 7;
  175. }
  176. // [#next-free-field: 8]
  177. message DeltaDiscoveryResponse {
  178. option (udpa.annotations.versioning).previous_message_type =
  179. "envoy.api.v2.DeltaDiscoveryResponse";
  180. // The version of the response data (used for debugging).
  181. string system_version_info = 1;
  182. // The response resources. These are typed resources, whose types must match
  183. // the type_url field.
  184. repeated Resource resources = 2;
  185. // field id 3 IS available!
  186. // Type URL for resources. Identifies the xDS API when muxing over ADS.
  187. // Must be consistent with the type_url in the Any within 'resources' if 'resources' is non-empty.
  188. string type_url = 4;
  189. // Resources names of resources that have be deleted and to be removed from the xDS Client.
  190. // Removed resources for missing resources can be ignored.
  191. repeated string removed_resources = 6;
  192. // The nonce provides a way for DeltaDiscoveryRequests to uniquely
  193. // reference a DeltaDiscoveryResponse when (N)ACKing. The nonce is required.
  194. string nonce = 5;
  195. // [#not-implemented-hide:]
  196. // The control plane instance that sent the response.
  197. config.core.v3.ControlPlane control_plane = 7;
  198. }
  199. // [#next-free-field: 8]
  200. message Resource {
  201. option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.Resource";
  202. // Cache control properties for the resource.
  203. // [#not-implemented-hide:]
  204. message CacheControl {
  205. // If true, xDS proxies may not cache this resource.
  206. // Note that this does not apply to clients other than xDS proxies, which must cache resources
  207. // for their own use, regardless of the value of this field.
  208. bool do_not_cache = 1;
  209. }
  210. // The resource's name, to distinguish it from others of the same type of resource.
  211. string name = 3;
  212. // The aliases are a list of other names that this resource can go by.
  213. repeated string aliases = 4;
  214. // The resource level version. It allows xDS to track the state of individual
  215. // resources.
  216. string version = 1;
  217. // The resource being tracked.
  218. google.protobuf.Any resource = 2;
  219. // Time-to-live value for the resource. For each resource, a timer is started. The timer is
  220. // reset each time the resource is received with a new TTL. If the resource is received with
  221. // no TTL set, the timer is removed for the resource. Upon expiration of the timer, the
  222. // configuration for the resource will be removed.
  223. //
  224. // The TTL can be refreshed or changed by sending a response that doesn't change the resource
  225. // version. In this case the resource field does not need to be populated, which allows for
  226. // light-weight "heartbeat" updates to keep a resource with a TTL alive.
  227. //
  228. // The TTL feature is meant to support configurations that should be removed in the event of
  229. // a management server failure. For example, the feature may be used for fault injection
  230. // testing where the fault injection should be terminated in the event that Envoy loses contact
  231. // with the management server.
  232. google.protobuf.Duration ttl = 6;
  233. // Cache control properties for the resource.
  234. // [#not-implemented-hide:]
  235. CacheControl cache_control = 7;
  236. }