xref: /aosp_15_r20/external/grpc-grpc/src/proto/grpc/testing/xds/v3/discovery.proto (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1// Copyright 2020 The gRPC Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Local copy of Envoy xDS proto file, used for testing only.
16
17syntax = "proto3";
18
19package envoy.service.discovery.v3;
20
21import "src/proto/grpc/testing/xds/v3/base.proto";
22
23import "google/protobuf/any.proto";
24import "google/protobuf/duration.proto";
25
26message Status {
27  // The status code, which should be an enum value of [google.rpc.Code][].
28  int32 code = 1;
29
30  // A developer-facing error message, which should be in English. Any
31  // user-facing error message should be localized and sent in the
32  // [google.rpc.Status.details][] field, or localized by the client.
33  string message = 2;
34
35  // A list of messages that carry the error details.  There is a common set of
36  // message types for APIs to use.
37  repeated google.protobuf.Any details = 3;
38}
39
40// [#protodoc-title: Common discovery API components]
41
42// A DiscoveryRequest requests a set of versioned resources of the same type for
43// a given Envoy node on some API.
44// [#next-free-field: 7]
45message DiscoveryRequest {
46  // The version_info provided in the request messages will be the version_info
47  // received with the most recent successfully processed response or empty on
48  // the first request. It is expected that no new request is sent after a
49  // response is received until the Envoy instance is ready to ACK/NACK the new
50  // configuration. ACK/NACK takes place by returning the new API config version
51  // as applied or the previous API config version respectively. Each type_url
52  // (see below) has an independent version associated with it.
53  string version_info = 1;
54
55  // The node making the request.
56  config.core.v3.Node node = 2;
57
58  // List of resources to subscribe to, e.g. list of cluster names or a route
59  // configuration name. If this is empty, all resources for the API are
60  // returned. LDS/CDS may have empty resource_names, which will cause all
61  // resources for the Envoy instance to be returned. The LDS and CDS responses
62  // will then imply a number of resources that need to be fetched via EDS/RDS,
63  // which will be explicitly enumerated in resource_names.
64  repeated string resource_names = 3;
65
66  // Type of the resource that is being requested, e.g.
67  // "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment". This is implicit
68  // in requests made via singleton xDS APIs such as CDS, LDS, etc. but is
69  // required for ADS.
70  string type_url = 4;
71
72  // nonce corresponding to DiscoveryResponse being ACK/NACKed. See above
73  // discussion on version_info and the DiscoveryResponse nonce comment. This
74  // may be empty only if 1) this is a non-persistent-stream xDS such as HTTP,
75  // or 2) the client has not yet accepted an update in this xDS stream (unlike
76  // delta, where it is populated only for new explicit ACKs).
77  string response_nonce = 5;
78
79  // This is populated when the previous :ref:`DiscoveryResponse <envoy_api_msg_service.discovery.v3.DiscoveryResponse>`
80  // failed to update configuration. The *message* field in *error_details* provides the Envoy
81  // internal exception related to the failure. It is only intended for consumption during manual
82  // debugging, the string provided is not guaranteed to be stable across Envoy versions.
83  Status error_detail = 6;
84}
85
86// [#next-free-field: 7]
87message DiscoveryResponse {
88  // The version of the response data.
89  string version_info = 1;
90
91  // The response resources. These resources are typed and depend on the API being called.
92  repeated google.protobuf.Any resources = 2;
93
94  // [#not-implemented-hide:]
95  // Canary is used to support two Envoy command line flags:
96  //
97  // * --terminate-on-canary-transition-failure. When set, Envoy is able to
98  //   terminate if it detects that configuration is stuck at canary. Consider
99  //   this example sequence of updates:
100  //   - Management server applies a canary config successfully.
101  //   - Management server rolls back to a production config.
102  //   - Envoy rejects the new production config.
103  //   Since there is no sensible way to continue receiving configuration
104  //   updates, Envoy will then terminate and apply production config from a
105  //   clean slate.
106  // * --dry-run-canary. When set, a canary response will never be applied, only
107  //   validated via a dry run.
108  bool canary = 3;
109
110  // Type URL for resources. Identifies the xDS API when muxing over ADS.
111  // Must be consistent with the type_url in the 'resources' repeated Any (if non-empty).
112  string type_url = 4;
113
114  // For gRPC based subscriptions, the nonce provides a way to explicitly ack a
115  // specific DiscoveryResponse in a following DiscoveryRequest. Additional
116  // messages may have been sent by Envoy to the management server for the
117  // previous version on the stream prior to this DiscoveryResponse, that were
118  // unprocessed at response send time. The nonce allows the management server
119  // to ignore any further DiscoveryRequests for the previous version until a
120  // DiscoveryRequest bearing the nonce. The nonce is optional and is not
121  // required for non-stream based xDS implementations.
122  string nonce = 5;
123}
124
125// [#next-free-field: 8]
126message Resource {
127  // Cache control properties for the resource.
128  // [#not-implemented-hide:]
129  message CacheControl {
130    // If true, xDS proxies may not cache this resource.
131    // Note that this does not apply to clients other than xDS proxies, which must cache resources
132    // for their own use, regardless of the value of this field.
133    bool do_not_cache = 1;
134  }
135
136  // The resource's name, to distinguish it from others of the same type of resource.
137  string name = 3;
138
139  // The aliases are a list of other names that this resource can go by.
140  repeated string aliases = 4;
141
142  // The resource level version. It allows xDS to track the state of individual
143  // resources.
144  string version = 1;
145
146  // The resource being tracked.
147  google.protobuf.Any resource = 2;
148
149  // Time-to-live value for the resource. For each resource, a timer is started. The timer is
150  // reset each time the resource is received with a new TTL. If the resource is received with
151  // no TTL set, the timer is removed for the resource. Upon expiration of the timer, the
152  // configuration for the resource will be removed.
153  //
154  // The TTL can be refreshed or changed by sending a response that doesn't change the resource
155  // version. In this case the resource field does not need to be populated, which allows for
156  // light-weight "heartbeat" updates to keep a resource with a TTL alive.
157  //
158  // The TTL feature is meant to support configurations that should be removed in the event of
159  // a management server failure. For example, the feature may be used for fault injection
160  // testing where the fault injection should be terminated in the event that Envoy loses contact
161  // with the management server.
162  google.protobuf.Duration ttl = 6;
163
164  // Cache control properties for the resource.
165  // [#not-implemented-hide:]
166  CacheControl cache_control = 7;
167}
168