Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ext_proc: send and receive dynamic metadata #30747

Merged
merged 47 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
8685df9
extract metadata changes from #29069
jbohanon Nov 6, 2023
e0faad9
add helloworld include to test BUILD
jbohanon Nov 6, 2023
cbfc6e7
nits
jbohanon Nov 9, 2023
d14c525
PR feedback
jbohanon Nov 16, 2023
ff755d4
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Nov 16, 2023
0c26d27
fix references, bind per filter config lifetime to filter
jbohanon Nov 17, 2023
b2411ce
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Nov 17, 2023
3624a91
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Nov 20, 2023
96cf64b
use callbacks function to access streamInfo
jbohanon Nov 20, 2023
a10537b
fix test redefinition
jbohanon Nov 21, 2023
70d155e
working on integration test
jbohanon Nov 21, 2023
570c1a4
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Dec 12, 2023
27fe509
add integration test and a TODO pending https://github.com/envoyproxy…
jbohanon Dec 14, 2023
b3fc808
use separate function since changing the other one broke timeout tests
jbohanon Dec 15, 2023
8f5c9ec
rip out helloworld proto for windows
jbohanon Dec 15, 2023
3e7da15
integration test receiving metadata
jbohanon Dec 19, 2023
776064f
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Dec 19, 2023
22d7281
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Dec 20, 2023
2b4d0b2
update test
jbohanon Dec 20, 2023
430fe84
fix test
jbohanon Dec 21, 2023
d18d3a7
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Jan 8, 2024
04af274
implement immutable per-route overrides
jbohanon Jan 8, 2024
170ca18
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Jan 8, 2024
1f4ede7
kick CI
jbohanon Jan 8, 2024
a8bd534
kick CI
jbohanon Jan 8, 2024
350d5e6
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Jan 15, 2024
4d1e5d3
use const in helper functions, add TODOs
jbohanon Jan 15, 2024
7a05123
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Jan 16, 2024
eb1613f
formatting
jbohanon Jan 16, 2024
2b526ea
make callbacks() const
jbohanon Jan 16, 2024
0eaac97
spelling
jbohanon Jan 16, 2024
4a925d4
implement merge options api
jbohanon Jan 17, 2024
2c51ad5
fix vector merge/lifetime
jbohanon Jan 18, 2024
5917584
remove unneeded using
jbohanon Jan 18, 2024
55ff013
fix windows compiler error
jbohanon Jan 18, 2024
6586bfb
formatting
jbohanon Jan 18, 2024
616cdeb
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Jan 18, 2024
6cb0f70
remove unnecessarily complex merge logic
jbohanon Jan 24, 2024
510a735
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Jan 24, 2024
f93e168
fix changelog
jbohanon Jan 24, 2024
8785017
fix streamInfo() invocation
jbohanon Jan 24, 2024
9516aaa
fix streamInfo() invocation
jbohanon Jan 24, 2024
b48aae8
kick CI
jbohanon Jan 25, 2024
c8f8a54
kick CI
jbohanon Jan 25, 2024
b159d7f
use less-specific namespaces if no more-specific exists
jbohanon Jan 30, 2024
14d368d
Merge branch 'main' into feature/ext_proc/dynamic-metadata
jbohanon Jan 30, 2024
019feca
fix test name
jbohanon Jan 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions api/envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
// **Current Implementation Status:**
// All options and processing modes are implemented except for the following:
//
// * Dynamic metadata in responses from the external processor is ignored.
// * "async mode" is not implemented.

// The filter communicates with an external gRPC service called an "external processor"
Expand Down Expand Up @@ -97,7 +96,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
// <arch_overview_advanced_filter_state_sharing>` object in a namespace matching the filter
// name.
//
// [#next-free-field: 16]
// [#next-free-field: 17]
message ExternalProcessor {
// Configuration for the gRPC service that the filter will communicate with.
// The filter supports both the "Envoy" and "Google" gRPC clients.
Expand Down Expand Up @@ -203,6 +202,35 @@ message ExternalProcessor {
// Instead, the stream to the external processor will be closed. There will be no
// more external processing for this stream from now on.
bool disable_immediate_response = 15;

// Options related to the sending and receiving of dynamic metadata.
MetadataOptions metadata_options = 16;
abeyad marked this conversation as resolved.
Show resolved Hide resolved
}

// The MetadataOptions structure defines options for the sending and receiving of
// dynamic metadata. Specifically, which namespaces to send to the server, whether
// metadata returned by the server may be written, and how that metadata may be written.
message MetadataOptions {
abeyad marked this conversation as resolved.
Show resolved Hide resolved
message MetadataNamespaces {
// Specifies a list of metadata namespaces whose values, if present,
// will be passed to the ext_proc service as an opaque *protobuf::Struct*.
repeated string untyped = 1;

// Specifies a list of metadata namespaces whose values, if present,
// will be passed to the ext_proc service as a *protobuf::Any*. This allows
// envoy and the external processing server to share the protobuf message
// definition for safe parsing.
repeated string typed = 2;
}

// Describes which typed or untyped dynamic metadata namespaces to forward to
abeyad marked this conversation as resolved.
Show resolved Hide resolved
// the external processing server.
MetadataNamespaces forwarding_namespaces = 1;

// Describes which typed or untyped dynamic metadata namespaces to accept from
// the external processing server. Set to empty or leave unset to disallow writing
// any received dynamic metadata. Receiving of typed metadata is not supported.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: receiving of typed metadata is not supported: Looks like it is because that only google.protobuf.Struct is defined in ProcessingResponse? Actually I am not very sure why protobuf.Any is not defined. Though this could be out of scope of this PR.

cc @gbrail

MetadataNamespaces receiving_namespaces = 2;
}

// The HeaderForwardingRules structure specifies what headers are
Expand Down Expand Up @@ -245,7 +273,7 @@ message ExtProcPerRoute {
}

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

// Set a different gRPC service for this route than the default.
config.core.v3.GrpcService grpc_service = 5;

// Options related to the sending and receiving of dynamic metadata.
// Lists of forwarding and receiving namespaces will be overridden in their entirety,
// meaning the most-specific config that specifies this override will be the final
// config used. It is the prerogative of the control plane to ensure this
// most-specific config contains the correct final overrides.
MetadataOptions metadata_options = 6;
abeyad marked this conversation as resolved.
Show resolved Hide resolved
}
11 changes: 7 additions & 4 deletions api/envoy/service/ext_proc/v3/external_processor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ service ExternalProcessor {

// This represents the different types of messages that Envoy can send
// to an external processing server.
// [#next-free-field: 8]
// [#next-free-field: 9]
message ProcessingRequest {
// Specify whether the filter that sent this request is running in synchronous
// or asynchronous mode. The choice of synchronous or asynchronous mode
Expand Down Expand Up @@ -115,6 +115,9 @@ message ProcessingRequest {
// in the filter configuration.
HttpTrailers response_trailers = 7;
}

// Dynamic metadata associated with the request.
config.core.v3.Metadata metadata_context = 8;
abeyad marked this conversation as resolved.
Show resolved Hide resolved
}

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

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

// Override how parts of the HTTP request and response are processed
Expand Down
8 changes: 8 additions & 0 deletions changelogs/current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,13 @@ new_features:
change: |
added support for :ref:`%UPSTREAM_CONNECTION_ID% <config_access_log_format_upstream_connection_id>` for the upstream connection
identifier.
- area: ext_proc
change: |
added
:ref:`metadata_options <envoy_v3_api_field_extensions.filters.http.ext_proc.v3.ExternalProcessor.metadata_options>`
config API to enable sending and receiving metadata from/to the external processing server. Both typed and untyped dynamic
metadata may be sent to the server. If
:ref:`receiving_namespaces <envoy_v3_api_field_extensions.filters.http.ext_proc.v3.MetadataOptions.receiving_namespaces>`
is defined, returned metadata may be written to the specified allowed namespaces.

deprecated:
Loading
Loading