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

xds: Change how xDS filters are created by introducing Filter.Provider #11883

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

sergiitk
Copy link
Member

@sergiitk sergiitk commented Feb 6, 2025

This is the first step towards supporting filter state retention in Java. The mechanism will be similar to the one described in A83 for C-core, and will serve the same purpose. However, the implementation details are very different due to the different nature of xDS HTTP filter support in C-core and Java.

In Java, xDS HTTP filters are backed by classes implementing io.grpc.xds.Filter, from here just called "Filters".
To support Filter state retention (next PR), Java's xDS implementation must be able to create unique Filter instances per:

  • Per HCM envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
  • Per filter name as specified in envoy.extensions.filters.network.http_connection_manager.v3.HttpFilter.name

This PR does not implements Filter state retention, but lays the groundwork for it by changing how filters are registered and instantiated. To achieve this, all existing Filter classes had to be updated to the new instantiation mechanism described below.

Prior to these this PR, Filters had no livecycle. FilterRegistry provided singleton instances for a given typeUrl. This PR introduces a new interface Filter.Provider, which instantiates Filter classes. All functionality that doesn't need an instance of a Filter is moved to the Filter.Provider. This includes parsing filter config proto into FilterConfig and determining the filter kind (client-side, server-side, or both).

This PR is limited to refactoring, and there's no changes to the existing behavior. Note that all Filter Providers still return singleton Filter instances. However, with this PR, it is now possible to create Providers that return a new Filter instance each time newInstance is called.

@sergiitk sergiitk force-pushed the xds-filter-provider branch 2 times, most recently from 3c0d7e7 to 9b3306d Compare February 7, 2025 19:02
@sergiitk sergiitk force-pushed the xds-filter-provider branch 4 times, most recently from dfba410 to be5f0fa Compare February 14, 2025 23:44
@sergiitk sergiitk marked this pull request as ready for review February 14, 2025 23:48
@sergiitk sergiitk requested a review from ejona86 February 14, 2025 23:48
@sergiitk sergiitk changed the title xds: Add support for persistent filter cache xds: Change how xDS filters are created by introducing Filter.Provider Feb 14, 2025
This is the first step towards supporting filter state retention in
Java. The mechanism will be similar to the one described in [A83]
(https://github.com/grpc/proposal/blob/master/A83-xds-gcp-authn-filter.md#filter-call-credentials-cache)
for C-core, and will serve the same purpose. However, the
implementation details are very different due to the different nature
of xDS HTTP filter support in C-core and Java.

In Java, xDS HTTP filters are backed by classes implementing
`io.grpc.xds.Filter`, from here just called "Filters". To support
Filter state retention (next PR), Java's xDS implementation must be
able to create unique Filter instances per:
- Per HCM
  `envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager`
- Per filter name as specified in
  `envoy.extensions.filters.network.http_connection_manager.v3.HttpFilter.name`

This PR **does not** implements Filter state retention, but lays the
groundwork for it by changing how filters are registered and
instantiated. To achieve this, all existing Filter classes had to be
updated to the new instantiation mechanism described below.

Prior to these this PR, Filters had no livecycle. FilterRegistry
provided singleton instances for a given typeUrl. This PR introduces
a new interface `Filter.Provider`, which instantiates Filter classes.
All functionality that doesn't need an instance of a Filter is moved
to the Filter.Provider. This includes parsing filter config proto
into FilterConfig and determining the filter kind
(client-side, server-side, or both).

This PR is limited to refactoring, and there's no changes to the
existing behavior. Note that all Filter Providers still return
singleton Filter instances. However, with this PR, it is now possible
to create Providers that return a new Filter instance each time
`newInstance` is called.
@sergiitk sergiitk force-pushed the xds-filter-provider branch from be5f0fa to 1b72990 Compare February 15, 2025 02:48
@sergiitk
Copy link
Member Author

Last force-push is a rebase again master and updating commit description. No more force-pushes from this point.

@sergiitk sergiitk merged commit 2b87b01 into grpc:master Feb 18, 2025
15 of 16 checks passed
@sergiitk sergiitk deleted the xds-filter-provider branch February 18, 2025 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants