-
Notifications
You must be signed in to change notification settings - Fork 4.9k
api: new field to the FilterConfig to disable a filter in specific route or vh #25927
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
Conversation
…ute or vh Signed-off-by: wbpcode <wangbaiping@corp.netease.com>
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
draft idea to the #20867 |
Is this just a generic filter disable at round config override level? Seems reasonable to me. CC @envoyproxy/api-shepherds |
Yeap. By this way, we can disable any filter in a specific route and needn't change any API of the filter. It means that the different routes could execute complete different filter chains. ideally, we can skip the disabled filters' creation when we create the filter chain. Then the disable filters will not bring any additional overhead at runtime. |
Thanks, this LGTM, and I like the idea of making it general across all filters.
|
@@ -2384,4 +2384,8 @@ message FilterConfig { | |||
// not support the specified filter, it may ignore the map entry rather | |||
// than rejecting the config. | |||
bool is_optional = 2; | |||
|
|||
// If true, the filter is disabled in the route or virtual host and the |
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.
I think the comment here should make it clear that the intent is to not even include the filter in the filter chain in the first place, as opposed to including the filter and having it be a no-op. Otherwise it's not clear why we need this, since most individual filters already have a way to turn themselves into a no-op.
I think we should also document the fact that the decision to exclude the filter is made when the route is initially chosen for the request, before the first filter is called. If one of the filters later changes attributes of the request and recomputes the route, it is too late at that point to change the set of filters that will be run for the request.
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.
Wow, you got it. that's what I want completely. 👍
Although, in my original opinion, the behavior depend on the implementation so I initially intend to document it more detailedly in a seperated doc.
This sounds reasonable to me too, as an alternative to composite filters for the typed_per_filter_configs, as a way to exempt some traffic from filters. |
Signed-off-by: wbpcode <wangbaiping@corp.netease.com>
Signed-off-by: wbpcode <wangbaiping@corp.netease.com>
More detailed comment is added. Advantages of this way:
Disadvantages of this way:
|
@wbpcode I don't recall - does this require that a filter explicitly implements "most specific filter config" in code, or is this automatic? |
This is automatic and it affects the filter chain directly, acting outside the filter. |
/retest |
Retrying Azure Pipelines: |
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
Signed-off-by: wbpcode <wangbaiping@corp.netease.com>
Seems there is no explict objection to the API and functions. I think we can merge it and then I can prepare a prototype of the implementation in the next days. 😄 |
/lgtm api |
A stamp from maintainer is still necessary. Friendly ping @htuch 😺 |
// initial route will not be added back to the filter chain because the filter chain is already | ||
// created and it is too late to change the chain. | ||
// | ||
// This field only make sense for the downstream HTTP filters for now. |
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.
Should add a not-implemented-yet annotation or merge this into the implementation PR. Otherwise LGTM, thanks.
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.
The FilterConfig
message are annotated as not-implemented
. So, it's unnecessary to add the annotation seperatedly for this field.
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
Commit Message: api: new field to the FilterConfig to disable a filter in specific route or vh
Risk Level: low.
Testing: n/a.
Docs Changes: n/a.
Release Notes: n/a.
Platform Specific Features: n/a.