gateway icon indicating copy to clipboard operation
gateway copied to clipboard

Support Filters in BackendRefs

Open MregXN opened this issue 1 year ago • 14 comments

I have encountered difficulties while using the Kubernetes Gateway API Filters under BackendRefs. Is the current envoy gateway already supported?

MregXN avatar Feb 07 '24 08:02 MregXN

@MregXN this is not supported, highlighted in https://gateway.envoyproxy.io/latest/user/gatewayapi-support/#httproute keeping this issue open to we can highlight this using a status condition

arkodg avatar Feb 07 '24 21:02 arkodg

I think I can help in making this issue achievable. But it seems that the fields of ir.HTTPRoute are not adequate for Filters in BackendRefs support because all filters will be translatrd into Redirect filed and there is no way to differentiate based on backendref. Should we need to somehow extend some new fields to ir.HTTPRoute ? @arkodg @cnvergence

MregXN avatar Feb 16 '24 16:02 MregXN

@MregXN can you share your use case of why you'd prefer enabling the filter on the backendRef instead of the route

arkodg avatar Feb 27 '24 22:02 arkodg

@arkodg I have two backend services pointing to the same hostname and path, with different weights set to distribute access traffic proportionally to the corresponding backend services. However, I now need to apply forwarding operations when traffic is routed to one of the backend services only. Therefore, I need to use a filter that only affects one backend. Using the filter in route will affect both backends simultaneously.

MregXN avatar Feb 28 '24 01:02 MregXN

@MregXN by forwarding operations, do you mean appending headers to the request or response ?

arkodg avatar Feb 28 '24 02:02 arkodg

@arkodg It has nothing to do with the header. I hope the user can receive the 302 status code when their traffic is routed to the specific backend.

MregXN avatar Feb 28 '24 02:02 MregXN

@MregXN hi, is there any process?

baildagq avatar Mar 25 '24 02:03 baildagq

I think this is a reasonable request for filter implementation, thoughts on this @arkodg ?

Xunzhuo avatar Mar 25 '24 03:03 Xunzhuo

@MregXN hi, is there any process?

I haven't started as I think we haven't reached a consensus yet.

MregXN avatar Mar 25 '24 06:03 MregXN

BackendRef Filters are needed by Knative - https://github.com/knative-extensions/net-gateway-api/issues/566

We specifically append headers after a traffic split - this enables our scale to zero feature as well as our ability to handle 'burst capacity'

dprotaso avatar Apr 02 '24 18:04 dprotaso

I miscalculated the effort to get this in :( The implementation seems straightforward

  1. Add new filter related fields in the DestinationSetting IR similar to this
  2. Set them in the Gateway API translator
  3. In the Xds Side, use a Weighted Cluster to represent this case, and populate the fields https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#config-route-v3-weightedcluster-clusterweight

The only issue I see is, there is no support for these specific filters at the weighted cluster level

  • Path rewrites
  • Redirect
  • Mirroring https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.HTTPRouteFilter these can probably be rejected for now, else will need to be enhanced in Envoy

arkodg avatar Apr 05 '24 09:04 arkodg

@cnvergence planning on working on this one ?

arkodg avatar Apr 05 '24 09:04 arkodg

sure, I can continue on this one seems like a valid feature

cnvergence avatar Apr 05 '24 11:04 cnvergence

This issue has been automatically marked as stale because it has not had activity in the last 30 days.

github-actions[bot] avatar May 05 '24 12:05 github-actions[bot]