|
| 1 | +syntax = "proto3"; |
| 2 | + |
| 3 | +package envoy.extensions.filters.http.ext_proc.v3; |
| 4 | + |
| 5 | +import "envoy/config/common/mutation_rules/v3/mutation_rules.proto"; |
| 6 | +import "envoy/config/core/v3/grpc_service.proto"; |
| 7 | +import "envoy/extensions/filters/http/ext_proc/v3/processing_mode.proto"; |
| 8 | +import "envoy/type/matcher/v3/string.proto"; |
| 9 | + |
| 10 | +import "google/protobuf/duration.proto"; |
| 11 | +import "google/protobuf/struct.proto"; |
| 12 | + |
| 13 | +import "udpa/annotations/status.proto"; |
| 14 | +import "validate/validate.proto"; |
| 15 | + |
| 16 | +option java_package = "io.envoyproxy.envoy.extensions.filters.http.ext_proc.v3"; |
| 17 | +option java_outer_classname = "ExtProcProto"; |
| 18 | +option java_multiple_files = true; |
| 19 | +option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3;ext_procv3"; |
| 20 | +option (udpa.annotations.file_status).package_version_status = ACTIVE; |
| 21 | + |
| 22 | +// [#protodoc-title: External Processing Filter] |
| 23 | +// External Processing Filter |
| 24 | +// [#extension: envoy.filters.http.ext_proc] |
| 25 | + |
| 26 | +// The External Processing filter allows an external service to act on HTTP traffic in a flexible way. |
| 27 | + |
| 28 | +// **Current Implementation Status:** |
| 29 | +// All options and processing modes are implemented except for the following: |
| 30 | +// |
| 31 | +// * Request and response attributes are not sent and not processed. |
| 32 | +// * Dynamic metadata in responses from the external processor is ignored. |
| 33 | +// * "async mode" is not implemented. |
| 34 | + |
| 35 | +// The filter communicates with an external gRPC service called an "external processor" |
| 36 | +// that can do a variety of things with the request and response: |
| 37 | +// |
| 38 | +// * Access and modify the HTTP headers on the request, response, or both |
| 39 | +// * Access and modify the HTTP request and response bodies |
| 40 | +// * Access and modify the dynamic stream metadata |
| 41 | +// * Immediately send an HTTP response downstream and terminate other processing |
| 42 | +// |
| 43 | +// The filter communicates with the server using a gRPC bidirectional stream. After the initial |
| 44 | +// request, the external server is in control over what additional data is sent to it |
| 45 | +// and how it should be processed. |
| 46 | +// |
| 47 | +// By implementing the protocol specified by the stream, the external server can choose: |
| 48 | +// |
| 49 | +// * Whether it receives the response message at all |
| 50 | +// * Whether it receives the message body at all, in separate chunks, or as a single buffer |
| 51 | +// * Whether subsequent HTTP requests are transmitted synchronously or whether they are |
| 52 | +// sent asynchronously. |
| 53 | +// * To modify request or response trailers if they already exist |
| 54 | +// * To add request or response trailers where they are not present |
| 55 | +// |
| 56 | +// The filter supports up to six different processing steps. Each is represented by |
| 57 | +// a gRPC stream message that is sent to the external processor. For each message, the |
| 58 | +// processor must send a matching response. |
| 59 | +// |
| 60 | +// * Request headers: Contains the headers from the original HTTP request. |
| 61 | +// * Request body: Sent in a single message if the BUFFERED or BUFFERED_PARTIAL |
| 62 | +// mode is chosen, in multiple messages if the STREAMED mode is chosen, and not |
| 63 | +// at all otherwise. |
| 64 | +// * Request trailers: Delivered if they are present and if the trailer mode is set |
| 65 | +// to SEND. |
| 66 | +// * Response headers: Contains the headers from the HTTP response. Keep in mind |
| 67 | +// that if the upstream system sends them before processing the request body that |
| 68 | +// this message may arrive before the complete body. |
| 69 | +// * Response body: Sent according to the processing mode like the request body. |
| 70 | +// * Response trailers: Delivered according to the processing mode like the |
| 71 | +// request trailers. |
| 72 | +// |
| 73 | +// By default, the processor sends only the request and response headers messages. |
| 74 | +// This may be changed to include any of the six steps by changing the processing_mode |
| 75 | +// setting of the filter configuration, or by setting the mode_override of any response |
| 76 | +// from the external processor. The latter is only enabled if allow_mode_override is |
| 77 | +// set to true. This way, a processor may, for example, use information |
| 78 | +// in the request header to determine whether the message body must be examined, or whether |
| 79 | +// the proxy should simply stream it straight through. |
| 80 | +// |
| 81 | +// All of this together allows a server to process the filter traffic in fairly |
| 82 | +// sophisticated ways. For example: |
| 83 | +// |
| 84 | +// * A server may choose to examine all or part of the HTTP message bodies depending |
| 85 | +// on the content of the headers. |
| 86 | +// * A server may choose to immediately reject some messages based on their HTTP |
| 87 | +// headers (or other dynamic metadata) and more carefully examine others. |
| 88 | +// * A server may asynchronously monitor traffic coming through the filter by inspecting |
| 89 | +// headers, bodies, or both, and then decide to switch to a synchronous processing |
| 90 | +// mode, either permanently or temporarily. |
| 91 | +// |
| 92 | +// The protocol itself is based on a bidirectional gRPC stream. Envoy will send the |
| 93 | +// server |
| 94 | +// :ref:`ProcessingRequest <envoy_v3_api_msg_service.ext_proc.v3.ProcessingRequest>` |
| 95 | +// messages, and the server must reply with |
| 96 | +// :ref:`ProcessingResponse <envoy_v3_api_msg_service.ext_proc.v3.ProcessingResponse>`. |
| 97 | +// |
| 98 | +// Stats about each gRPC call are recorded in a :ref:`dynamic filter state |
| 99 | +// <arch_overview_advanced_filter_state_sharing>` object in a namespace matching the filter |
| 100 | +// name. |
| 101 | +// |
| 102 | +// [#next-free-field: 15] |
| 103 | +message ExternalProcessor { |
| 104 | + // Configuration for the gRPC service that the filter will communicate with. |
| 105 | + // The filter supports both the "Envoy" and "Google" gRPC clients. |
| 106 | + config.core.v3.GrpcService grpc_service = 1 [(validate.rules).message = {required: true}]; |
| 107 | + |
| 108 | + // By default, if the gRPC stream cannot be established, or if it is closed |
| 109 | + // prematurely with an error, the filter will fail. Specifically, if the |
| 110 | + // response headers have not yet been delivered, then it will return a 500 |
| 111 | + // error downstream. If they have been delivered, then instead the HTTP stream to the |
| 112 | + // downstream client will be reset. |
| 113 | + // With this parameter set to true, however, then if the gRPC stream is prematurely closed |
| 114 | + // or could not be opened, processing continues without error. |
| 115 | + bool failure_mode_allow = 2; |
| 116 | + |
| 117 | + // Specifies default options for how HTTP headers, trailers, and bodies are |
| 118 | + // sent. See ProcessingMode for details. |
| 119 | + ProcessingMode processing_mode = 3; |
| 120 | + |
| 121 | + // [#not-implemented-hide:] |
| 122 | + // If true, send each part of the HTTP request or response specified by ProcessingMode |
| 123 | + // asynchronously -- in other words, send the message on the gRPC stream and then continue |
| 124 | + // filter processing. If false, which is the default, suspend filter execution after |
| 125 | + // each message is sent to the remote service and wait up to "message_timeout" |
| 126 | + // for a reply. |
| 127 | + bool async_mode = 4; |
| 128 | + |
| 129 | + // [#not-implemented-hide:] |
| 130 | + // Envoy provides a number of :ref:`attributes <arch_overview_attributes>` |
| 131 | + // for expressive policies. Each attribute name provided in this field will be |
| 132 | + // matched against that list and populated in the request_headers message. |
| 133 | + // See the :ref:`attribute documentation <arch_overview_request_attributes>` |
| 134 | + // for the list of supported attributes and their types. |
| 135 | + repeated string request_attributes = 5; |
| 136 | + |
| 137 | + // [#not-implemented-hide:] |
| 138 | + // Envoy provides a number of :ref:`attributes <arch_overview_attributes>` |
| 139 | + // for expressive policies. Each attribute name provided in this field will be |
| 140 | + // matched against that list and populated in the response_headers message. |
| 141 | + // See the :ref:`attribute documentation <arch_overview_attributes>` |
| 142 | + // for the list of supported attributes and their types. |
| 143 | + repeated string response_attributes = 6; |
| 144 | + |
| 145 | + // Specifies the timeout for each individual message sent on the stream and |
| 146 | + // when the filter is running in synchronous mode. Whenever the proxy sends |
| 147 | + // a message on the stream that requires a response, it will reset this timer, |
| 148 | + // and will stop processing and return an error (subject to the processing mode) |
| 149 | + // if the timer expires before a matching response is received. There is no |
| 150 | + // timeout when the filter is running in asynchronous mode. Zero is a valid |
| 151 | + // config which means the timer will be triggered immediately. If not |
| 152 | + // configured, default is 200 milliseconds. |
| 153 | + google.protobuf.Duration message_timeout = 7 [(validate.rules).duration = { |
| 154 | + lte {seconds: 3600} |
| 155 | + gte {} |
| 156 | + }]; |
| 157 | + |
| 158 | + // Optional additional prefix to use when emitting statistics. This allows to distinguish |
| 159 | + // emitted statistics between configured *ext_proc* filters in an HTTP filter chain. |
| 160 | + string stat_prefix = 8; |
| 161 | + |
| 162 | + // Rules that determine what modifications an external processing server may |
| 163 | + // make to message headers. If not set, all headers may be modified except |
| 164 | + // for "host", ":authority", ":scheme", ":method", and headers that start |
| 165 | + // with the header prefix set via |
| 166 | + // :ref:`header_prefix <envoy_v3_api_field_config.bootstrap.v3.Bootstrap.header_prefix>` |
| 167 | + // (which is usually "x-envoy"). |
| 168 | + // Note that changing headers such as "host" or ":authority" may not in itself |
| 169 | + // change Envoy's routing decision, as routes can be cached. To also force the |
| 170 | + // route to be recomputed, set the |
| 171 | + // :ref:`clear_route_cache <envoy_v3_api_field_service.ext_proc.v3.CommonResponse.clear_route_cache>` |
| 172 | + // field to true in the same response. |
| 173 | + config.common.mutation_rules.v3.HeaderMutationRules mutation_rules = 9; |
| 174 | + |
| 175 | + // Specify the upper bound of |
| 176 | + // :ref:`override_message_timeout <envoy_v3_api_field_service.ext_proc.v3.ProcessingResponse.override_message_timeout>` |
| 177 | + // If not specified, by default it is 0, which will effectively disable the ``override_message_timeout`` API. |
| 178 | + google.protobuf.Duration max_message_timeout = 10 [(validate.rules).duration = { |
| 179 | + lte {seconds: 3600} |
| 180 | + gte {} |
| 181 | + }]; |
| 182 | + |
| 183 | + // Prevents clearing the route-cache when the |
| 184 | + // :ref:`clear_route_cache <envoy_v3_api_field_service.ext_proc.v3.CommonResponse.clear_route_cache>` |
| 185 | + // field is set in an external processor response. |
| 186 | + bool disable_clear_route_cache = 11; |
| 187 | + |
| 188 | + // Allow headers matching the ``forward_rules`` to be forwarded to the external processing server. |
| 189 | + // If not set, all headers are forwarded to the external processing server. |
| 190 | + HeaderForwardingRules forward_rules = 12; |
| 191 | + |
| 192 | + // Additional metadata to be added to the filter state for logging purposes. The metadata |
| 193 | + // will be added to StreamInfo's filter state under the namespace corresponding to the |
| 194 | + // ext_proc filter name. |
| 195 | + google.protobuf.Struct filter_metadata = 13; |
| 196 | + |
| 197 | + // If ``allow_mode_override`` is set to true, the filter config :ref:`processing_mode |
| 198 | + // <envoy_v3_api_field_extensions.filters.http.ext_proc.v3.ExternalProcessor.processing_mode>` |
| 199 | + // can be overridden by the response message from the external processing server |
| 200 | + // :ref:`mode_override <envoy_v3_api_field_service.ext_proc.v3.ProcessingResponse.mode_override>`. |
| 201 | + // If not set, ``mode_override`` API in the response message will be ignored. |
| 202 | + bool allow_mode_override = 14; |
| 203 | +} |
| 204 | + |
| 205 | +// The HeaderForwardingRules structure specifies what headers are |
| 206 | +// allowed to be forwarded to the external processing server. |
| 207 | +message HeaderForwardingRules { |
| 208 | + // If not set, all headers are forwarded to the external processing server. |
| 209 | + type.matcher.v3.ListStringMatcher allowed_headers = 1; |
| 210 | +} |
| 211 | + |
| 212 | +// Extra settings that may be added to per-route configuration for a |
| 213 | +// virtual host or cluster. |
| 214 | +message ExtProcPerRoute { |
| 215 | + oneof override { |
| 216 | + option (validate.required) = true; |
| 217 | + |
| 218 | + // Disable the filter for this particular vhost or route. |
| 219 | + // If disabled is specified in multiple per-filter-configs, the most specific one will be used. |
| 220 | + bool disabled = 1 [(validate.rules).bool = {const: true}]; |
| 221 | + |
| 222 | + // Override aspects of the configuration for this route. A set of |
| 223 | + // overrides in a more specific configuration will override a "disabled" |
| 224 | + // flag set in a less-specific one. |
| 225 | + ExtProcOverrides overrides = 2; |
| 226 | + } |
| 227 | +} |
| 228 | + |
| 229 | +// Overrides that may be set on a per-route basis |
| 230 | +// [#next-free-field: 6] |
| 231 | +message ExtProcOverrides { |
| 232 | + // Set a different processing mode for this route than the default. |
| 233 | + ProcessingMode processing_mode = 1; |
| 234 | + |
| 235 | + // [#not-implemented-hide:] |
| 236 | + // Set a different asynchronous processing option than the default. |
| 237 | + bool async_mode = 2; |
| 238 | + |
| 239 | + // [#not-implemented-hide:] |
| 240 | + // Set different optional attributes than the default setting of the |
| 241 | + // ``request_attributes`` field. |
| 242 | + repeated string request_attributes = 3; |
| 243 | + |
| 244 | + // [#not-implemented-hide:] |
| 245 | + // Set different optional properties than the default setting of the |
| 246 | + // ``response_attributes`` field. |
| 247 | + repeated string response_attributes = 4; |
| 248 | + |
| 249 | + // Set a different gRPC service for this route than the default. |
| 250 | + config.core.v3.GrpcService grpc_service = 5; |
| 251 | +} |
0 commit comments