filter: clean up unnecessary redundancy - #46835
Conversation
Signed-off-by: wbpcode <wbphub@gmail.com>
Signed-off-by: wbpcode <wbphub@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR continues the Envoy HTTP filter factory unification work by introducing a new UnifiedFactoryBase and migrating a set of in-tree HTTP filters away from redundant legacy factory entrypoints, using a richer ExtraFactoryContext to carry per-call state.
Changes:
- Add
Extensions::HttpFilters::Common::UnifiedFactoryBaseto centralize downstream/upstream factory creation and validation viaExtraFactoryContext. - Extend
Server::Configuration::ExtraFactoryContext(scope/init manager/is_upstream) and addisUnifiedFilter()/upstreamcreateHttpFilterFactoryFromProto()hooks to differentiate unified vs legacy factories. - Migrate many HTTP filters from
ExceptionFreeFactoryBase/DualFactoryBasetoUnifiedFactoryBaseand delete now-redundant delegating implementations; update a few call sites to use the new extra context plumbing.
Reviewed changes
Copilot reviewed 55 out of 55 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/extensions/filters/http/ext_authz/config_test.cc | Updates test setup around validation visitor usage for unified factory path. |
| source/server/generic_factory_context.h | Adjusts GenericFactoryContextImpl ctor(s) to accept optional scope/init manager via OptRef. |
| source/server/generic_factory_context.cc | Updates ctor implementations and initManager() assertion for OptRef storage. |
| source/extensions/filters/http/common/factory_base.h | Introduces UnifiedFactoryBase and uses ExtraFactoryContext::create(...) for unified entrypoints. |
| envoy/server/filter_config.h | Extends ExtraFactoryContext and adds unified-filter differentiation (isUnifiedFilter) plus upstream createHttpFilterFactoryFromProto API. |
| source/extensions/filters/http/sse_to_metadata/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/sse_to_metadata/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/set_filter_state/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/set_filter_state/config.cc | Removes redundant legacy factory implementation; uses ExtraFactoryContext for validation/scope/init manager when building GenericFactoryContextImpl. |
| source/extensions/filters/http/proto_message_extraction/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/proto_message_extraction/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/original_src/original_src_config_factory.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/original_src/original_src_config_factory.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/on_demand/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/on_demand/config.cc | Deletes redundant delegating factory implementation; uses extra_context.visitor for validation. |
| source/extensions/filters/http/mcp/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/mcp/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/mcp_json_rest_bridge/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/mcp_json_rest_bridge/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/header_mutation/config.h | Migrates dual filter factory to UnifiedFactoryBase and removes redundant dual factory entrypoint. |
| source/extensions/filters/http/header_mutation/config.cc | Deletes redundant dual factory implementation. |
| source/extensions/filters/http/grpc_web/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/grpc_web/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/grpc_json_reverse_transcoder/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/grpc_json_reverse_transcoder/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/grpc_http1_reverse_bridge/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/grpc_http1_reverse_bridge/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/grpc_http1_bridge/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/grpc_http1_bridge/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/grpc_field_extraction/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/grpc_field_extraction/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/file_system_buffer/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/file_system_buffer/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/ext_authz/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy delegation. |
| source/extensions/filters/http/dynamic_forward_proxy/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/dynamic_forward_proxy/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/custom_response/factory.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/custom_response/factory.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/connect_grpc_bridge/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/connect_grpc_bridge/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/compressor/config.cc | Updates GenericFactoryContextImpl construction to match new init-manager OptRef signature. |
| source/extensions/filters/http/cdn_loop/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/cdn_loop/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/cache/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/cache/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/cache_v2/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/cache_v2/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/buffer/config.h | Migrates dual filter factory to UnifiedFactoryBase and removes redundant dual factory entrypoint. |
| source/extensions/filters/http/buffer/config.cc | Deletes redundant dual factory implementation. |
| source/extensions/filters/http/body_size_limit/config.h | Migrates dual filter factory to UnifiedFactoryBase and removes redundant dual factory entrypoint. |
| source/extensions/filters/http/body_size_limit/config.cc | Deletes redundant dual factory implementation. |
| source/extensions/filters/http/alternate_protocols_cache/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/alternate_protocols_cache/config.cc | Deletes redundant delegating factory implementation. |
| source/extensions/filters/http/a2a/config.h | Migrates to UnifiedFactoryBase and removes redundant legacy factory override. |
| source/extensions/filters/http/a2a/config.cc | Deletes redundant delegating factory implementation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ravenblackx
left a comment
There was a problem hiding this comment.
Love to approve PRs that are more deletion than addition. :)
| } | ||
|
|
||
| /** | ||
| * @return bool true if this filter is a unified filter who implements |
There was a problem hiding this comment.
| * @return bool true if this filter is a unified filter who implements | |
| * @return bool true if this filter is a unified filter that implements |
There was a problem hiding this comment.
If CI is happy, I will ignore this and update the grammar at follow up PRs. :)
|
/retest |
Commit Message: filter: clean up unnecessary redundancy
Additional Description:
Another step to unify all three types of HTTP filter factories (downstream, upstream, route).
No behavior changes, won’t break out-of-tree extensions and only a purely cleanup to reduce unnecessary redundancy.
We will finally migrate all our in-tree extensions to use the
UnifiedFactoryBase, then we could gradually deprecate the redundant interfaces. (I made a huge commit locally that has proved it works perfectly, although need some changes tocomposite. This is first piece of that)Risk Level: low
Testing: n/a.
Docs Changes: n/a.
Release Notes: n/a.
Platform Specific Features: n/a.