config: support determine terminal filter at runtime#15803
config: support determine terminal filter at runtime#15803snowp merged 29 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@outlook.com>
Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@gmail.com> add a test Signed-off-by: qinggniq <livewithblank@gmail.com> add test Signed-off-by: qinggniq <livewithblank@gmail.com> add test Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@gmail.com> fix typo Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@gmail.com>
snowp
left a comment
There was a problem hiding this comment.
Thanks this makes sense, just some questions around how we'll handle the dynamic case
| * @param filter_config_name the filter config resource name. | ||
| * @param factory_context is the context to use for the filter config provider. | ||
| * @param stat_prefix supplies the stat_prefix to use for the provider stats. | ||
| * @param last_filter_in_current_config indicate the filter position at filter chain |
There was a problem hiding this comment.
maybe something like indicates whether this filter is the last filter in the configured chain
| const envoy::config::core::v3::ExtensionConfigSource& config_source, | ||
| const std::string& filter_config_name, Server::Configuration::FactoryContext& factory_context, | ||
| const std::string& stat_prefix) PURE; | ||
| const std::string& stat_prefix, bool last_filter_in_current_config, |
There was a problem hiding this comment.
maybe just last_filter? or last_filter_in_filter_chain? not sure what "current" is referring to
There was a problem hiding this comment.
last_filter_in_filter_chain better.
| this->current_config_ = config; | ||
| }); | ||
| } | ||
| void DynamicFilterConfigProviderImpl::validateTermianlFilter(const std::string& name, |
| "Unexpected number of resources in ExtensionConfigDS response: {}", resources.size())); | ||
| } | ||
| const auto& filter_config = dynamic_cast<const envoy::config::core::v3::TypedExtensionConfig&>( | ||
| auto& filter_config = dynamic_cast<const envoy::config::core::v3::TypedExtensionConfig&>( |
There was a problem hiding this comment.
why remove the const here? we cast to a const ref
There was a problem hiding this comment.
sorry, did not notice.
| absl::optional<Envoy::Http::FilterFactoryCb> last_config_{absl::nullopt}; | ||
| std::string last_type_url_; | ||
| std::string last_version_info_; | ||
| envoy::config::core::v3::TypedExtensionConfig last_filter_config_; |
There was a problem hiding this comment.
I think we intentionally avoid storing the entire filter config, can we just track whether the last filter passed the terminal filter check?
There was a problem hiding this comment.
Yes, we only need it_terminal_filter
Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@gmail.com>
|
Can you merge main to resolve conflicts and look at getting CI green? Thanks |
Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@gmail.com>
|
@snowp I think the remain ci flakes is due to not update https://github.com/envoyproxy/envoy-filter-example, should I give a pr to that repo? |
snowp
left a comment
There was a problem hiding this comment.
Thanks, just a couple comments
CI seems to still be broken
/wait
| TEST_F(FilterConfigDiscoveryImplTest, DualProvidersInvalid) { | ||
| InSequence s; | ||
| setup(); | ||
| auto provider2 = createProvider("foo", true, false); |
| EXPECT_EQ("500", response->headers().getStatusValue()); | ||
| } | ||
|
|
||
| // test when terminal filter config not put at last config position |
There was a problem hiding this comment.
nit: proper sentence, proper casing + punctuation
| string prefix = 1; | ||
| uint32 code = 2 [(validate.rules).uint32 = {lt: 600 gte: 200}]; | ||
| string body = 3; | ||
| bool is_terminal_filter = 4; |
There was a problem hiding this comment.
I would do this in a different test filter instead of overloading the existing one
Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@gmail.com>
snowp
left a comment
There was a problem hiding this comment.
Thanks this LGTM. Can you check CI? I think the asan/tsan ones are legit
|
Oh actually no those are the filter example ones you mentioned, let me look into how we can fix this |
|
@qinggniq Can you make a PR to envoy-filter-example and point the SHA in ci/filter_example_setup.sh to the commit in the PR? That should let this PR test against the envoy-filter-example PR |
Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@gmail.com>
|
/retest |
|
Retrying Azure Pipelines: |
Signed-off-by: qinggniq <livewithblank@gmail.com>
|
The failures of ci |
Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@gmail.com>
Signed-off-by: qinggniq <livewithblank@gmail.com>
|
/retest |
1 similar comment
|
/retest |
|
Retrying Azure Pipelines: |
|
Retrying Azure Pipelines: |
|
@snowp all cis are green, waiting for envoyproxy/envoy-filter-example#144 merged. I will change the commit SHA and URL at ci/setup_example_filter.sh to the latest commit. |
|
I merged the filter example PR, can you update this to use the new commit and we'll get this landed? Thanks |
Signed-off-by: qinggniq <livewithblank@gmail.com>
Currently we validate terminal filter before getting real protobuf message, now envoy can determine a filter whether is a terminal filter base on the protobuf message. Signed-off-by: qinggniq <livewithblank@gmail.com> Signed-off-by: Gokul Nair <gnair@twitter.com>
fix #15565.
Currently we validate terminal filter before getting real protobuf message, now envoy can determine a filter whether is a terminal filter base on the protobuf message.
Commit Message: config: support determine terminal filter at runtime
Additional Description:
Risk Level: Low
Testing: TBD
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]