-
Notifications
You must be signed in to change notification settings - Fork 5.1k
compressor: expose compressor_library for per-route overrides #41177
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
base: main
Are you sure you want to change the base?
Conversation
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
d6b7121
to
946d93b
Compare
Signed-off-by: Rohit Agrawal <[email protected]>
946d93b
to
c7a96e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. One high level comment to start the work :)
Envoy::Compression::Compressor::CompressorFactory& CompressorFilter::getCompressorFactory() const { | ||
const auto* per_route_config = | ||
Http::Utility::resolveMostSpecificPerFilterConfig<CompressorPerRouteFilterConfig>( | ||
decoder_callbacks_); | ||
if (per_route_config && per_route_config->compressorFactory()) { | ||
return const_cast<Envoy::Compression::Compressor::CompressorFactory&>( | ||
*per_route_config->compressorFactory()); | ||
} | ||
return const_cast<Envoy::Compression::Compressor::CompressorFactory&>( | ||
config_->compressorFactory()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create a field in the filter to store the route level config and ensure the field could be initialized only once. Note, the route config maybe changed because the route refreshment. Keeping the route level config in filter could avoid the potential inconsistence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Signed-off-by: Rohit Agrawal <[email protected]>
Description
We have a requirement to select GZip vs. Brotli on some specific routes. In this PR, we are adding support for per-route compressor library override in the compressor filter. With this change, routes would be able to specify a different compressor library (e.g., gzip, brotli) via the
compressor_library
field on a per-route basis.This would allow different routes to use different compression algorithms and settings while maintaining the same filter configuration.
Commit Message: compressor: expose compressor_library for per-route overrides
Additional Description: Added support to allow different routes to use different compression algorithms and settings while maintaining the same filter configuration.
Risk Level: Low
Testing: Added Unit + Integration Tests
Docs Changes: Added
Release Notes: Added