Skip to content

Commit 0939428

Browse files
committed
ext_proc: send and receive dynamic metadata (envoyproxy#30747)
Introduce the ability to send dynamic metadata in the External Processing Request. Also implements the API for returning dynamic metadata as part of the External Processing Response. --------- Signed-off-by: Jacob Bohanon <[email protected]>
1 parent 2deb25e commit 0939428

File tree

12 files changed

+1107
-29
lines changed

12 files changed

+1107
-29
lines changed

api/envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto

+38-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
2828
// **Current Implementation Status:**
2929
// All options and processing modes are implemented except for the following:
3030
//
31-
// * Dynamic metadata in responses from the external processor is ignored.
3231
// * "async mode" is not implemented.
3332

3433
// The filter communicates with an external gRPC service called an "external processor"
@@ -97,7 +96,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
9796
// <arch_overview_advanced_filter_state_sharing>` object in a namespace matching the filter
9897
// name.
9998
//
100-
// [#next-free-field: 16]
99+
// [#next-free-field: 17]
101100
message ExternalProcessor {
102101
// Configuration for the gRPC service that the filter will communicate with.
103102
// The filter supports both the "Envoy" and "Google" gRPC clients.
@@ -203,6 +202,35 @@ message ExternalProcessor {
203202
// Instead, the stream to the external processor will be closed. There will be no
204203
// more external processing for this stream from now on.
205204
bool disable_immediate_response = 15;
205+
206+
// Options related to the sending and receiving of dynamic metadata.
207+
MetadataOptions metadata_options = 16;
208+
}
209+
210+
// The MetadataOptions structure defines options for the sending and receiving of
211+
// dynamic metadata. Specifically, which namespaces to send to the server, whether
212+
// metadata returned by the server may be written, and how that metadata may be written.
213+
message MetadataOptions {
214+
message MetadataNamespaces {
215+
// Specifies a list of metadata namespaces whose values, if present,
216+
// will be passed to the ext_proc service as an opaque *protobuf::Struct*.
217+
repeated string untyped = 1;
218+
219+
// Specifies a list of metadata namespaces whose values, if present,
220+
// will be passed to the ext_proc service as a *protobuf::Any*. This allows
221+
// envoy and the external processing server to share the protobuf message
222+
// definition for safe parsing.
223+
repeated string typed = 2;
224+
}
225+
226+
// Describes which typed or untyped dynamic metadata namespaces to forward to
227+
// the external processing server.
228+
MetadataNamespaces forwarding_namespaces = 1;
229+
230+
// Describes which typed or untyped dynamic metadata namespaces to accept from
231+
// the external processing server. Set to empty or leave unset to disallow writing
232+
// any received dynamic metadata. Receiving of typed metadata is not supported.
233+
MetadataNamespaces receiving_namespaces = 2;
206234
}
207235

208236
// The HeaderForwardingRules structure specifies what headers are
@@ -245,7 +273,7 @@ message ExtProcPerRoute {
245273
}
246274

247275
// Overrides that may be set on a per-route basis
248-
// [#next-free-field: 6]
276+
// [#next-free-field: 7]
249277
message ExtProcOverrides {
250278
// Set a different processing mode for this route than the default.
251279
ProcessingMode processing_mode = 1;
@@ -266,4 +294,11 @@ message ExtProcOverrides {
266294

267295
// Set a different gRPC service for this route than the default.
268296
config.core.v3.GrpcService grpc_service = 5;
297+
298+
// Options related to the sending and receiving of dynamic metadata.
299+
// Lists of forwarding and receiving namespaces will be overridden in their entirety,
300+
// meaning the most-specific config that specifies this override will be the final
301+
// config used. It is the prerogative of the control plane to ensure this
302+
// most-specific config contains the correct final overrides.
303+
MetadataOptions metadata_options = 6;
269304
}

api/envoy/service/ext_proc/v3/external_processor.proto

+7-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ service ExternalProcessor {
5656

5757
// This represents the different types of messages that Envoy can send
5858
// to an external processing server.
59-
// [#next-free-field: 8]
59+
// [#next-free-field: 9]
6060
message ProcessingRequest {
6161
// Specify whether the filter that sent this request is running in synchronous
6262
// or asynchronous mode. The choice of synchronous or asynchronous mode
@@ -115,6 +115,9 @@ message ProcessingRequest {
115115
// in the filter configuration.
116116
HttpTrailers response_trailers = 7;
117117
}
118+
119+
// Dynamic metadata associated with the request.
120+
config.core.v3.Metadata metadata_context = 8;
118121
}
119122

120123
// For every ProcessingRequest received by the server with the ``async_mode`` field
@@ -158,9 +161,9 @@ message ProcessingResponse {
158161
ImmediateResponse immediate_response = 7;
159162
}
160163

161-
// [#not-implemented-hide:]
162-
// Optional metadata that will be emitted as dynamic metadata to be consumed by the next
163-
// filter. This metadata will be placed in the namespace ``envoy.filters.http.ext_proc``.
164+
// Optional metadata that will be emitted as dynamic metadata to be consumed by
165+
// following filters. This metadata will be placed in the namespace(s) specified by the top-level
166+
// field name(s) of the struct.
164167
google.protobuf.Struct dynamic_metadata = 8;
165168

166169
// Override how parts of the HTTP request and response are processed

changelogs/current.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,13 @@ new_features:
2727
and
2828
:ref:`response_attributes <envoy_v3_api_field_extensions.filters.http.ext_proc.v3.ExternalProcessor.response_attributes>`
2929
config APIs to enable sending and receiving attributes to/from the external processing server.
30+
- area: ext_proc
31+
change: |
32+
added
33+
:ref:`metadata_options <envoy_v3_api_field_extensions.filters.http.ext_proc.v3.ExternalProcessor.metadata_options>`
34+
config API to enable sending and receiving metadata from/to the external processing server. Both typed and untyped dynamic
35+
metadata may be sent to the server. If
36+
:ref:`receiving_namespaces <envoy_v3_api_field_extensions.filters.http.ext_proc.v3.MetadataOptions.receiving_namespaces>`
37+
is defined, returned metadata may be written to the specified allowed namespaces.
3038
3139
deprecated:

0 commit comments

Comments
 (0)