Skip to content

extproc: register filter and parse base and override config#9073

Open
eshitachandwani wants to merge 4 commits intogrpc:masterfrom
eshitachandwani:parsing_proc
Open

extproc: register filter and parse base and override config#9073
eshitachandwani wants to merge 4 commits intogrpc:masterfrom
eshitachandwani:parsing_proc

Conversation

@eshitachandwani
Copy link
Copy Markdown
Member

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_CLIENT flag.

#ext-proc-a93

RELEASE NOTES: None

@eshitachandwani eshitachandwani added this to the 1.82 Release milestone Apr 17, 2026
@eshitachandwani eshitachandwani added the Type: Feature New features or improvements in behavior label Apr 17, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 17, 2026

Codecov Report

❌ Patch coverage is 78.26087% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.05%. Comparing base (06fc26a) to head (2eac09b).

Files with missing lines Patch % Lines
internal/xds/httpfilter/extproc/ext_proc.go 78.26% 7 Missing and 3 partials ⚠️
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     
Files with missing lines Coverage Δ
internal/xds/httpfilter/extproc/ext_proc.go 78.26% <78.26%> (ø)

... and 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mbissa
Copy link
Copy Markdown
Contributor

mbissa commented Apr 17, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +48 to +53
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)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

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.

Suggested change
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)
}

Comment on lines +101 to +102
RequestBodyMode: fpb.ProcessingMode_GRPC,
ResponseBodyMode: fpb.ProcessingMode_GRPC,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Update test case to use STREAMED mode instead of the non-existent GRPC mode.

Suggested change
RequestBodyMode: fpb.ProcessingMode_GRPC,
ResponseBodyMode: fpb.ProcessingMode_GRPC,
RequestBodyMode: fpb.ProcessingMode_STREAMED,
ResponseBodyMode: fpb.ProcessingMode_STREAMED,

Comment on lines +117 to +118
RequestBodyMode: fpb.ProcessingMode_GRPC,
ResponseBodyMode: fpb.ProcessingMode_GRPC,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Update expected configuration to use STREAMED mode.

Suggested change
RequestBodyMode: fpb.ProcessingMode_GRPC,
ResponseBodyMode: fpb.ProcessingMode_GRPC,
RequestBodyMode: fpb.ProcessingMode_STREAMED,
ResponseBodyMode: fpb.ProcessingMode_STREAMED,

Comment on lines +179 to +183
ProcessingMode: &fpb.ProcessingMode{RequestBodyMode: fpb.ProcessingMode_STREAMED},
})
return m
}(),
wantErr: "ext_proc: invalid request body mode STREAMED",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

STREAMED is a valid mode according to A93. This test case should be updated to test an invalid mode like BUFFERED.

Suggested change
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",

Comment on lines +197 to +201
ProcessingMode: &fpb.ProcessingMode{ResponseBodyMode: fpb.ProcessingMode_STREAMED},
})
return m
}(),
wantErr: "ext_proc: invalid response body mode STREAMED",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Update test case to use an invalid mode like BUFFERED for response body, as STREAMED should be accepted.

Suggested change
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",

Comment on lines +268 to +269
RequestBodyMode: fpb.ProcessingMode_GRPC,
ResponseBodyMode: fpb.ProcessingMode_GRPC,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Update expected override configuration to use STREAMED mode.

Suggested change
RequestBodyMode: fpb.ProcessingMode_GRPC,
ResponseBodyMode: fpb.ProcessingMode_GRPC,
RequestBodyMode: fpb.ProcessingMode_STREAMED,
ResponseBodyMode: fpb.ProcessingMode_STREAMED,

Comment on lines +296 to +300
ProcessingMode: &fpb.ProcessingMode{RequestBodyMode: fpb.ProcessingMode_STREAMED},
})
return m
}(),
wantErr: "ext_proc: invalid request body mode STREAMED",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Update override error test case to use an invalid mode like BUFFERED.

Suggested change
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",

Comment on lines +308 to +313
ResponseBodyMode: fpb.ProcessingMode_STREAMED,
},
})
return m
}(),
wantErr: "ext_proc: invalid response body mode STREAMED",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Update override error test case to use an invalid mode like BUFFERED for response body.

Suggested change
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",

Comment on lines +61 to +64
m, ok := cfg.(*anypb.Any)
if !ok {
return nil, fmt.Errorf("ext_proc: error parsing config %v: unknown type %T", cfg, cfg)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

ParseFilterConfig should handle udpa.type.v1.TypedStruct and xds.type.v3.TypedStruct in addition to anypb.Any, as required by the Builder interface documentation in httpfilter.go. Restricting it to *anypb.Any will cause parsing failures for configurations wrapped in TypedStruct.

Comment on lines +88 to +91
m, ok := override.(*anypb.Any)
if !ok {
return nil, fmt.Errorf("ext_proc: error parsing override %v: unknown type %T", override, override)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

ParseFilterConfigOverride should also support TypedStruct types, similar to ParseFilterConfig, to ensure compatibility with different xDS configuration formats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New features or improvements in behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants