extproc: register filter and parse base and override config#9073
extproc: register filter and parse base and override config#9073eshitachandwani wants to merge 4 commits intogrpc:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9073 +/- ##
==========================================
+ Coverage 80.52% 83.05% +2.52%
==========================================
Files 413 414 +1
Lines 33543 33517 -26
==========================================
+ Hits 27012 27837 +825
+ Misses 4316 4248 -68
+ Partials 2215 1432 -783
🚀 New features to boost your workflow:
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request implements the Envoy external processing (ext_proc) HTTP filter for xDS, including configuration parsing for base and override settings. The reviewer noted that the implementation incorrectly uses a non-existent GRPC body processing mode instead of STREAMED and lacks support for TypedStruct types in the configuration parser. As a result, the validation logic and unit tests require updates to correctly handle supported processing modes and additional configuration formats.
| if reqMode := pMode.GetRequestBodyMode(); reqMode != fpb.ProcessingMode_NONE && reqMode != fpb.ProcessingMode_GRPC { | ||
| return fmt.Errorf("ext_proc: invalid request body mode %v: want 'NONE' or 'GRPC'", reqMode) | ||
| } | ||
| if resMode := pMode.GetResponseBodyMode(); resMode != fpb.ProcessingMode_NONE && resMode != fpb.ProcessingMode_GRPC { | ||
| return fmt.Errorf("ext_proc: invalid response body mode %v: want 'NONE' or 'GRPC'", resMode) | ||
| } |
There was a problem hiding this comment.
The ext_proc filter should support STREAMED body processing mode as per the A93 proposal. Additionally, fpb.ProcessingMode_GRPC does not appear to be a valid value in the Envoy BodySendMode enum; it should be fpb.ProcessingMode_STREAMED.
| if reqMode := pMode.GetRequestBodyMode(); reqMode != fpb.ProcessingMode_NONE && reqMode != fpb.ProcessingMode_GRPC { | |
| return fmt.Errorf("ext_proc: invalid request body mode %v: want 'NONE' or 'GRPC'", reqMode) | |
| } | |
| if resMode := pMode.GetResponseBodyMode(); resMode != fpb.ProcessingMode_NONE && resMode != fpb.ProcessingMode_GRPC { | |
| return fmt.Errorf("ext_proc: invalid response body mode %v: want 'NONE' or 'GRPC'", resMode) | |
| } | |
| if reqMode := pMode.GetRequestBodyMode(); reqMode != fpb.ProcessingMode_NONE && reqMode != fpb.ProcessingMode_STREAMED { | |
| return fmt.Errorf("ext_proc: invalid request body mode %v: want 'NONE' or 'STREAMED'", reqMode) | |
| } | |
| if resMode := pMode.GetResponseBodyMode(); resMode != fpb.ProcessingMode_NONE && resMode != fpb.ProcessingMode_STREAMED { | |
| return fmt.Errorf("ext_proc: invalid response body mode %v: want 'NONE' or 'STREAMED'", resMode) | |
| } |
| RequestBodyMode: fpb.ProcessingMode_GRPC, | ||
| ResponseBodyMode: fpb.ProcessingMode_GRPC, |
There was a problem hiding this comment.
| RequestBodyMode: fpb.ProcessingMode_GRPC, | ||
| ResponseBodyMode: fpb.ProcessingMode_GRPC, |
| ProcessingMode: &fpb.ProcessingMode{RequestBodyMode: fpb.ProcessingMode_STREAMED}, | ||
| }) | ||
| return m | ||
| }(), | ||
| wantErr: "ext_proc: invalid request body mode STREAMED", |
There was a problem hiding this comment.
STREAMED is a valid mode according to A93. This test case should be updated to test an invalid mode like BUFFERED.
| ProcessingMode: &fpb.ProcessingMode{RequestBodyMode: fpb.ProcessingMode_STREAMED}, | |
| }) | |
| return m | |
| }(), | |
| wantErr: "ext_proc: invalid request body mode STREAMED", | |
| ProcessingMode: &fpb.ProcessingMode{RequestBodyMode: fpb.ProcessingMode_BUFFERED}, | |
| }) | |
| return m | |
| }(), | |
| wantErr: "ext_proc: invalid request body mode BUFFERED", |
| ProcessingMode: &fpb.ProcessingMode{ResponseBodyMode: fpb.ProcessingMode_STREAMED}, | ||
| }) | ||
| return m | ||
| }(), | ||
| wantErr: "ext_proc: invalid response body mode STREAMED", |
There was a problem hiding this comment.
Update test case to use an invalid mode like BUFFERED for response body, as STREAMED should be accepted.
| ProcessingMode: &fpb.ProcessingMode{ResponseBodyMode: fpb.ProcessingMode_STREAMED}, | |
| }) | |
| return m | |
| }(), | |
| wantErr: "ext_proc: invalid response body mode STREAMED", | |
| ProcessingMode: &fpb.ProcessingMode{ResponseBodyMode: fpb.ProcessingMode_BUFFERED}, | |
| }) | |
| return m | |
| }(), | |
| wantErr: "ext_proc: invalid response body mode BUFFERED", |
| RequestBodyMode: fpb.ProcessingMode_GRPC, | ||
| ResponseBodyMode: fpb.ProcessingMode_GRPC, |
| ProcessingMode: &fpb.ProcessingMode{RequestBodyMode: fpb.ProcessingMode_STREAMED}, | ||
| }) | ||
| return m | ||
| }(), | ||
| wantErr: "ext_proc: invalid request body mode STREAMED", |
There was a problem hiding this comment.
Update override error test case to use an invalid mode like BUFFERED.
| ProcessingMode: &fpb.ProcessingMode{RequestBodyMode: fpb.ProcessingMode_STREAMED}, | |
| }) | |
| return m | |
| }(), | |
| wantErr: "ext_proc: invalid request body mode STREAMED", | |
| ProcessingMode: &fpb.ProcessingMode{RequestBodyMode: fpb.ProcessingMode_BUFFERED}, | |
| }) | |
| return m | |
| }(), | |
| wantErr: "ext_proc: invalid request body mode BUFFERED", |
| ResponseBodyMode: fpb.ProcessingMode_STREAMED, | ||
| }, | ||
| }) | ||
| return m | ||
| }(), | ||
| wantErr: "ext_proc: invalid response body mode STREAMED", |
There was a problem hiding this comment.
Update override error test case to use an invalid mode like BUFFERED for response body.
| ResponseBodyMode: fpb.ProcessingMode_STREAMED, | |
| }, | |
| }) | |
| return m | |
| }(), | |
| wantErr: "ext_proc: invalid response body mode STREAMED", | |
| ResponseBodyMode: fpb.ProcessingMode_BUFFERED, | |
| }, | |
| }) | |
| return m | |
| }(), | |
| wantErr: "ext_proc: invalid response body mode BUFFERED", |
| m, ok := cfg.(*anypb.Any) | ||
| if !ok { | ||
| return nil, fmt.Errorf("ext_proc: error parsing config %v: unknown type %T", cfg, cfg) | ||
| } |
There was a problem hiding this comment.
| m, ok := override.(*anypb.Any) | ||
| if !ok { | ||
| return nil, fmt.Errorf("ext_proc: error parsing override %v: unknown type %T", override, override) | ||
| } |
This PR is part of implementing A93: xds-ext-proc
This PR adds the ext_proc filter and the builder that implements the builder interface. That includes parsing and validating the base and the override config. The registration of the filter is under the
GRPC_EXPERIMENTAL_XDS_EXT_PROC_ON_CLIENTflag.#ext-proc-a93
RELEASE NOTES: None