• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2019 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// This file contains the eds protocol and its dependency.
16//
17// TODO(juanlishen): This file is a hack to avoid a problem we're
18// currently having where we can't depend on a proto file in an external
19// repo due to bazel limitations.  Once that's fixed, this should be
20// removed.  Until this, it should be used in the gRPC tests only, or else it
21// will cause a conflict due to the same proto messages being defined in
22// multiple files in the same binary.
23
24syntax = "proto3";
25
26package envoy.api.v2;
27
28import "google/protobuf/any.proto";
29import "google/protobuf/wrappers.proto";
30import "src/proto/grpc/testing/xds/cds_for_test.proto";
31import "src/proto/grpc/testing/xds/eds_for_test.proto";
32
33message RegexMatcher {
34  message GoogleRE2 {
35    google.protobuf.UInt32Value max_program_size = 1;
36  }
37  oneof engine_type {
38    GoogleRE2 google_re2 = 1;
39  }
40  string regex = 2;
41}
42
43message Int64Range {
44  // start of the range (inclusive)
45  int64 start = 1;
46
47  // end of the range (exclusive)
48  int64 end = 2;
49}
50
51message BoolValue {
52  // The bool value.
53  bool value = 1;
54}
55
56message HeaderMatcher {
57  string name = 1;
58  oneof header_match_specifier {
59    string exact_match = 4;
60    RegexMatcher safe_regex_match = 11;
61    Int64Range range_match = 6;
62    bool present_match = 7;
63    string prefix_match = 9;
64    string suffix_match = 10;
65  }
66  bool invert_match = 8;
67}
68
69message QueryParameterMatcher {
70  string name = 1;
71}
72
73message RuntimeFractionalPercent {
74  FractionalPercent default_value = 1;
75}
76
77message RouteMatch {
78  oneof path_specifier {
79    // If specified, the route is a prefix rule meaning that the prefix must
80    // match the beginning of the *:path* header.
81    string prefix = 1;
82    string path = 2;
83    RegexMatcher safe_regex = 10;
84  }
85  BoolValue case_sensitive = 4;
86  repeated QueryParameterMatcher query_parameters = 7;
87  RuntimeFractionalPercent runtime_fraction = 9;
88  repeated HeaderMatcher headers = 6;
89}
90
91message WeightedCluster {
92  message ClusterWeight {
93    string name = 1;
94    google.protobuf.UInt32Value weight = 2;
95  }
96  repeated ClusterWeight clusters = 1;
97  google.protobuf.UInt32Value  total_weight = 3;
98}
99
100message RouteAction {
101  oneof cluster_specifier {
102    // Indicates the upstream cluster to which the request should be routed
103    // to.
104    string cluster = 1;
105
106    // Envoy will determine the cluster to route to by reading the value of the
107    // HTTP header named by cluster_header from the request headers. If the
108    // header is not found or the referenced cluster does not exist, Envoy will
109    // return a 404 response.
110    //
111    // .. attention::
112    //
113    //   Internally, Envoy always uses the HTTP/2 *:authority* header to represent the HTTP/1
114    //   *Host* header. Thus, if attempting to match on *Host*, match on *:authority* instead.
115    string cluster_header = 2;
116    // Multiple upstream clusters can be specified for a given route. The
117    // request is routed to one of the upstream clusters based on weights
118    // assigned to each cluster. See
119    // :ref:`traffic splitting <config_http_conn_man_route_table_traffic_splitting_split>`
120    // for additional documentation.
121    WeightedCluster weighted_clusters = 3;
122  }
123}
124
125message RedirectAction {}
126
127message Route {
128   RouteMatch match = 1;
129
130   oneof action {
131     // Route request to some upstream cluster.
132     RouteAction route = 2;
133
134     // Return a redirect.
135     RedirectAction redirect = 3;
136   }
137}
138
139message VirtualHost {
140  repeated string domains = 2;
141  repeated Route routes = 3;
142}
143
144message Rds {
145  // Configuration source specifier for RDS.
146  ConfigSource config_source = 1;
147
148  // The name of the route configuration. This name will be passed to the RDS
149  // API. This allows an Envoy configuration with multiple HTTP listeners (and
150  // associated HTTP connection manager filters) to use different route
151  // configurations.
152  string route_config_name = 2;
153}
154
155message RouteConfiguration {
156  // The name of the route configuration. For example, it might match
157  // :ref:`route_config_name
158  // <envoy_api_field_config.filter.network.http_connection_manager.v2.Rds.route_config_name>` in
159  // :ref:`envoy_api_msg_config.filter.network.http_connection_manager.v2.Rds`.
160  string name = 1;
161
162  // An array of virtual hosts that make up the route table.
163  repeated VirtualHost virtual_hosts = 2;
164}
165
166message ScopedRoutes {}
167
168message HttpConnectionManager {
169  oneof route_specifier {
170    // The connection manager’s route table will be dynamically loaded via the RDS API.
171    Rds rds = 3;
172
173    // The route table for the connection manager is static and is specified in this property.
174    RouteConfiguration route_config = 4;
175
176    // A route table will be dynamically assigned to each request based on request attributes
177    // (e.g., the value of a header). The "routing scopes" (i.e., route tables) and "scope keys" are
178    // specified in this message.
179    ScopedRoutes scoped_routes = 31;
180  }
181}
182
183message ApiListener {
184  // The type in this field determines the type of API listener. At present, the following
185  // types are supported:
186  //   envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager (HTTP)
187  // [#next-major-version: In the v3 API, replace this Any field with a oneof containing the
188  // specific config message for each type of API listener. We could not do this in v2 because
189  // it would have caused circular dependencies for go protos: lds.proto depends on this file,
190  // and http_connection_manager.proto depends on rds.proto, which is in the same directory as
191  // lds.proto, so lds.proto cannot depend on this file.]
192  google.protobuf.Any api_listener = 1;
193}
194
195message Listener {
196  string name = 1;
197
198  // Used to represent an API listener, which is used in non-proxy clients. The type of API
199  // exposed to the non-proxy application depends on the type of API listener.
200  // When this field is set, no other field except for :ref:`name<envoy_api_field_Listener.name>`
201  // should be set.
202  //
203  // .. note::
204  //
205  //  Currently only one ApiListener can be installed; and it can only be done via bootstrap config,
206  //  not LDS.
207  //
208  // [#next-major-version: In the v3 API, instead of this messy approach where the socket
209  // listener fields are directly in the top-level Listener message and the API listener types
210  // are in the ApiListener message, the socket listener messages should be in their own message,
211  // and the top-level Listener should essentially be a oneof that selects between the
212  // socket listener and the various types of API listener. That way, a given Listener message
213  // can structurally only contain the fields of the relevant type.]
214  ApiListener api_listener = 19;
215}
216