Skip to content
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

enable a disabled filter by complete empty config or meaningless placeholder in the route #31482

Open
wbpcode opened this issue Dec 21, 2023 · 7 comments
Labels
area/router enhancement Feature requests. Not bugs or questions. no stalebot Disables stalebot from closing an issue

Comments

@wbpcode
Copy link
Member

wbpcode commented Dec 21, 2023

Now, we can mark a filter in the HTTP filter chain as disabled by default and enable it by a valid route per filter config in the route/vh. See the following example. The filter lua will be disabled by default and be skipped when creating HTTP filter chain instance, except it's re-enabled by a valid route config in specific route. By this way, we can achieve the target of configuring route specific HTTP filter chain. Different route could have different HTTP filter chain.

  http_filters:
  - name: buffer
    typed_config: { ... }
    disabled: true
  - name: lua
    typed_config: { ... }
    disabled: true


  typed_per_filter_config:
    lua:
      "@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute
      name: my_lua_script

However, there two special case that haven't been handled appropriately:

  • A filter may have no a route level config definition but also wants this feature.
  • A filter may just want to enable the filter but doesn't want to provide any route override config.
@wbpcode wbpcode added enhancement Feature requests. Not bugs or questions. triage Issue requires triage area/router and removed triage Issue requires triage labels Dec 21, 2023
@wbpcode
Copy link
Member Author

wbpcode commented Dec 21, 2023

cc @adisuissa @envoyproxy/api-shepherds

@wbpcode
Copy link
Member Author

wbpcode commented Dec 21, 2023

There are some possible solutions:

  1. Hack of current FilterConfig. This is supported and works, but far off from good. We can config an arbitrary proto config in the FilterConfig and set the is_optional to true. Then Envoy will accept this config and treat is an enable flag.
  typed_per_filter_config:
    lua:
      "@type": type.googleapis.com/envoy.config.route.v3.FilterConfig
      config: # Note this config field could not be empty because the xDS API requirement.
        "@type": type.googleapis.com/google.protobuf.Empty  # Empty as a placeholder.
      is_optional: true
  1. Make the google.protobuf.Emtpy as special placeholder and without setting the is_optional field. This need additional development to support this logic.
  typed_per_filter_config:
    lua:
      "@type": type.googleapis.com/envoy.config.route.v3.FilterConfig
      config: # Note this config field could not be empty because current validation.
        "@type": type.googleapis.com/google.protobuf.Empty  # Empty as a placeholder.
  1. Accept empty config field, and treat FilterConfig that has no any field be set as enable flag. This need additional development to remove current validation.
  typed_per_filter_config:
    lua:
      "@type": type.googleapis.com/envoy.config.route.v3.FilterConfig
  1. Like 2 but define a new message as placeholder to avoid using google.protobuf.Empty. This need additional development to support this logic.
  typed_per_filter_config:
    lua:
      "@type": type.googleapis.com/envoy.config.route.v3.FilterConfig
      config:
        "@type": type.googleapis.com/envoy.config.route.v3.Placeholder

@adisuissa
Copy link
Contributor

Two other options:

  1. Add an enabled/override_disabled field in FilterConfig to override the disabled flag.
  2. Add an external enable_per_config with a set (repeated) of names of filters to enable (less likely IMHO).

Copy link

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale stalebot believes this issue/PR has not been touched recently label Jan 20, 2024
@wbpcode wbpcode added no stalebot Disables stalebot from closing an issue and removed stale stalebot believes this issue/PR has not been touched recently labels Jan 23, 2024
@marc-barry
Copy link
Contributor

I ran into the same need in #33791 as #33791 (comment) suggested 1. from #31482 (comment). I was unable to get this to work at this time. I think that #33791 (comment) and #33791 (comment) are what 1. is suggesting.

@wbpcode
Copy link
Member Author

wbpcode commented Apr 29, 2024

@marc-barry check the latest comment #33791 (comment) :)

@marc-barry
Copy link
Contributor

@marc-barry check the latest comment #33791 (comment) :)

For those of you who encounter this issue #33791 (comment) did work as suggested and was a solution to suit my needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/router enhancement Feature requests. Not bugs or questions. no stalebot Disables stalebot from closing an issue
Projects
None yet
Development

No branches or pull requests

3 participants