xref: /aosp_15_r20/external/grpc-grpc-java/xds/third_party/envoy/src/main/proto/envoy/config/route/v3/scoped_route.proto (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1syntax = "proto3";
2
3package envoy.config.route.v3;
4
5import "envoy/config/route/v3/route.proto";
6
7import "udpa/annotations/migrate.proto";
8import "udpa/annotations/status.proto";
9import "udpa/annotations/versioning.proto";
10import "validate/validate.proto";
11
12option java_package = "io.envoyproxy.envoy.config.route.v3";
13option java_outer_classname = "ScopedRouteProto";
14option java_multiple_files = true;
15option go_package = "github.com/envoyproxy/go-control-plane/envoy/config/route/v3;routev3";
16option (udpa.annotations.file_status).package_version_status = ACTIVE;
17
18// [#protodoc-title: HTTP scoped routing configuration]
19// * Routing :ref:`architecture overview <arch_overview_http_routing>`
20
21// Specifies a routing scope, which associates a
22// :ref:`Key<envoy_v3_api_msg_config.route.v3.ScopedRouteConfiguration.Key>` to a
23// :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration`.
24// The :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration` can be obtained dynamically
25// via RDS (:ref:`route_configuration_name<envoy_v3_api_field_config.route.v3.ScopedRouteConfiguration.route_configuration_name>`)
26// or specified inline (:ref:`route_configuration<envoy_v3_api_field_config.route.v3.ScopedRouteConfiguration.route_configuration>`).
27//
28// The HTTP connection manager builds up a table consisting of these Key to
29// RouteConfiguration mappings, and looks up the RouteConfiguration to use per
30// request according to the algorithm specified in the
31// :ref:`scope_key_builder<envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.ScopedRoutes.scope_key_builder>`
32// assigned to the HttpConnectionManager.
33//
34// For example, with the following configurations (in YAML):
35//
36// HttpConnectionManager config:
37//
38// .. code::
39//
40//   ...
41//   scoped_routes:
42//     name: foo-scoped-routes
43//     scope_key_builder:
44//       fragments:
45//         - header_value_extractor:
46//             name: X-Route-Selector
47//             element_separator: ,
48//             element:
49//               separator: =
50//               key: vip
51//
52// ScopedRouteConfiguration resources (specified statically via
53// :ref:`scoped_route_configurations_list<envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.ScopedRoutes.scoped_route_configurations_list>`
54// or obtained dynamically via SRDS):
55//
56// .. code::
57//
58//  (1)
59//   name: route-scope1
60//   route_configuration_name: route-config1
61//   key:
62//      fragments:
63//        - string_key: 172.10.10.20
64//
65//  (2)
66//   name: route-scope2
67//   route_configuration_name: route-config2
68//   key:
69//     fragments:
70//       - string_key: 172.20.20.30
71//
72// A request from a client such as:
73//
74// .. code::
75//
76//     GET / HTTP/1.1
77//     Host: foo.com
78//     X-Route-Selector: vip=172.10.10.20
79//
80// would result in the routing table defined by the ``route-config1``
81// RouteConfiguration being assigned to the HTTP request/stream.
82//
83// [#next-free-field: 6]
84message ScopedRouteConfiguration {
85  option (udpa.annotations.versioning).previous_message_type =
86      "envoy.api.v2.ScopedRouteConfiguration";
87
88  // Specifies a key which is matched against the output of the
89  // :ref:`scope_key_builder<envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.ScopedRoutes.scope_key_builder>`
90  // specified in the HttpConnectionManager. The matching is done per HTTP
91  // request and is dependent on the order of the fragments contained in the
92  // Key.
93  message Key {
94    option (udpa.annotations.versioning).previous_message_type =
95        "envoy.api.v2.ScopedRouteConfiguration.Key";
96
97    message Fragment {
98      option (udpa.annotations.versioning).previous_message_type =
99          "envoy.api.v2.ScopedRouteConfiguration.Key.Fragment";
100
101      oneof type {
102        option (validate.required) = true;
103
104        // A string to match against.
105        string string_key = 1;
106      }
107    }
108
109    // The ordered set of fragments to match against. The order must match the
110    // fragments in the corresponding
111    // :ref:`scope_key_builder<envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.ScopedRoutes.scope_key_builder>`.
112    repeated Fragment fragments = 1 [(validate.rules).repeated = {min_items: 1}];
113  }
114
115  // Whether the RouteConfiguration should be loaded on demand.
116  bool on_demand = 4;
117
118  // The name assigned to the routing scope.
119  string name = 1 [(validate.rules).string = {min_len: 1}];
120
121  // The resource name to use for a :ref:`envoy_v3_api_msg_service.discovery.v3.DiscoveryRequest` to an
122  // RDS server to fetch the :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration` associated
123  // with this scope.
124  string route_configuration_name = 2
125      [(udpa.annotations.field_migrate).oneof_promotion = "route_config"];
126
127  // The :ref:`envoy_v3_api_msg_config.route.v3.RouteConfiguration` associated with the scope.
128  RouteConfiguration route_configuration = 5
129      [(udpa.annotations.field_migrate).oneof_promotion = "route_config"];
130
131  // The key to match against.
132  Key key = 3 [(validate.rules).message = {required: true}];
133}
134