Skip to content

Allow injecting bootstrap info into xDS Filter API for config parsing#12724

Open
sauravzg wants to merge 8 commits intogrpc:masterfrom
sauravzg:feat/bootstrap-filter-context
Open

Allow injecting bootstrap info into xDS Filter API for config parsing#12724
sauravzg wants to merge 8 commits intogrpc:masterfrom
sauravzg:feat/bootstrap-filter-context

Conversation

@sauravzg
Copy link
Collaborator

This sits on top of #12492 , so please view the commits after it.

Extend the xDS Filter API to support injecting bootstrap information into
filters during configuration parsing. This allows filters to access context
information (e.g., allowed gRPC services) from the resource loading layer
during configuration validation and parsing.

  • Update Filter.Provider.parseFilterConfig and parseFilterConfigOverride
    to accept a FilterContext parameter.
  • Introduce BootstrapInfoGrpcServiceContextProvider to encapsulate
    bootstrap info for context resolution.
  • Update XdsListenerResource and XdsRouteConfigureResource to
    construct and pass FilterContext during configuration parsing.
  • Update sub-filters (FaultFilter, RbacFilter, GcpAuthenticationFilter,
    RouterFilter) to match the updated FilterContext signature.

Known Gaps & Limitations:

  1. MetricHolder: Propagation of MetricHolder is not supported with
    this approach currently and is planned for support in a later phase.
  2. NameResolverRegistry: Propagation is deferred for consistency. While
    it could be passed from XdsNameResolver on the client side, there is
    no equivalent mechanism on the server side. To ensure consistent behavior,
    DefaultRegistry is used when validating schemes and creating channels.

This commit introduces configuration objects for the external authorization (ExtAuthz) filter and the gRPC service it uses. These classes provide a structured, immutable representation of the configuration defined in the xDS protobuf messages.

The main new classes are:
- `ExtAuthzConfig`: Represents the configuration for the `ExtAuthz` filter, including settings for the gRPC service, header mutation rules, and other filter behaviors.
- `GrpcServiceConfig`: Represents the configuration for a gRPC service, including the target URI, credentials, and other settings.
- `HeaderMutationRulesConfig`: Represents the configuration for header mutation rules.

This commit also includes parsers to create these configuration objects from the corresponding protobuf messages, as well as unit tests for the new classes.
… bug

Makes `allowedGrpcServices` to be a non-optional struct instead of
an `Optional<Map<str,AllowedService>>` since it's
essentially an immuatable hash map, making it preferable to use an empty
instance instead of null.

Change a small bug where we continued instead of return when parsing
bootstrap credentials.
…fig parsing

Extend the xDS Filter API to support injecting bootstrap information into
filters during configuration parsing. This allows filters to access context
information (e.g., allowed gRPC services) from the resource loading layer
during configuration validation and parsing.

- Update `Filter.Provider.parseFilterConfig` and `parseFilterConfigOverride`
  to accept a `FilterContext` parameter.
- Introduce `BootstrapInfoGrpcServiceContextProvider` to encapsulate
  bootstrap info for context resolution.
- Update `XdsListenerResource` and `XdsRouteConfigureResource` to
  construct and pass `FilterContext` during configuration parsing.
- Update sub-filters (`FaultFilter`, `RbacFilter`, `GcpAuthenticationFilter`,
  `RouterFilter`) to match the updated `FilterContext` signature.

Known Gaps & Limitations:
1. **MetricHolder**: Propagation of `MetricHolder` is not supported with
   this approach currently and is planned for support in a later phase.
2. **NameResolverRegistry**: Propagation is deferred for consistency. While
   it could be passed from `XdsNameResolver` on the client side, there is
   no equivalent mechanism on the server side. To ensure consistent behavior,
   `DefaultRegistry` is used when validating schemes and creating channels.
@sauravzg
Copy link
Collaborator Author

@kannanjgithub @AgraVator PTAL and add yourself as reviewers on the PR. Thanks.

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.

1 participant