Skip to content

xds: Implement channel caching utility for GrpcService channels for ext_authz and ext_proc#12690

Open
sauravzg wants to merge 4 commits intogrpc:masterfrom
sauravzg:feat/cached-channel
Open

xds: Implement channel caching utility for GrpcService channels for ext_authz and ext_proc#12690
sauravzg wants to merge 4 commits intogrpc:masterfrom
sauravzg:feat/cached-channel

Conversation

@sauravzg
Copy link
Contributor

Child PR of #12492

Split this from some other PR way down the chain and modified it to be not ext authz specific.

  • This is currently a thread safe trivial implementation of caching based on (target, channel_creds)
  • This is intended to be instantiated per Filter and not be used as some sort of a shared channel pool
  • On a config change that requires creating new channels, this may perform 2 blocking operations before returning
  • Creation of the channel and this happens within a lock
  • shutdown of old channel if present

This should probably be okay, since this happens in the control path changes but has the potential of hammering dataplane throughtput temporarily during updates due to channel creation within the lock.

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.
Copy link
Contributor

@kannanjgithub kannanjgithub left a comment

Choose a reason for hiding this comment

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

Minor changes requested.

delegate.applyRequestMetadata(requestInfo, appExecutor, applier);
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Remove multiple blank lines here and below before the end of the file.

try {
channelCreds = extractChannelCredentials(googleGrpcProto.getChannelCredentialsPluginList());
} catch (GrpcServiceParseException e) {
// Fall back to channel_credentials if plugins are not supported
Copy link
Contributor

Choose a reason for hiding this comment

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

It is going to fail at line 160 below because channelCreds is null. We are not using call_credentials field, as per the grfc.


/**
* Constructor for testing to inject a channel creator.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Add @VisibleForTesting annotation.

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