discovery.proto 11 KB

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