Skip to content

gatewayapi: add support for route rule filters#1512

Merged
aryan9600 merged 1 commit intomainfrom
gw-filters
Sep 22, 2023
Merged

gatewayapi: add support for route rule filters#1512
aryan9600 merged 1 commit intomainfrom
gw-filters

Conversation

@aryan9600
Copy link
Copy Markdown
Member

@aryan9600 aryan9600 commented Sep 12, 2023

Add support for Filters in the HTTPRoute API. We reuse most of the existing fields used for Istio to construct the appopriate filter. A new API .spec.service.mirror is added to allow for request mirroring. The .spec.service.rewrite API has been changed to a custom HTTPRewrite API instead of importing it from Istio, to allow covering all features that Gateway API provides.
Support for the RequestRedirect Filter has been left out on purpose, since it's not possible to specify it if the same rule also specifies .backendRefs (which Flagger does).

Fixes #1488

@stefanprodan
Copy link
Copy Markdown
Member

Mirroring is a property of the analysis, so I would expect for Flagger to configure Gateway API mirroring automatically, from primary to canary based on .spec.analysis.mirror.

@aryan9600
Copy link
Copy Markdown
Member Author

aryan9600 commented Sep 15, 2023

i think we should allow for mirroring using both service and analysis. .spec.analysis.mirror would enable request mirroring to the Canary deployment, while .spec.service.mirror would mirror the request to the specified backend.

since adding support for .spec.analysis.mirror means adding support for the B/G mirror deployment strategy and would probably require changes in other places like the scheduler, i suggest we tackle that in another PR.

Copy link
Copy Markdown
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @aryan9600

Add support for [`Filters`](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.HTTPRouteFilter)
in the HTTPRoute API. We reuse most of the existing fields used for
Istio to construct the appopriate filter. A new API
`.spec.service.mirror` is added to allow for request mirroring. The
`.spec.service.rewrite` API has been changed to a custom `HTTPRewrite`
API instead of importing it from Istio, to allow covering all features
that Gateway API provides.

Support for the [`RequestRedirect`](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.HTTPRequestRedirectFilter)
Filter has been left out on purpose, since it's not possible to specify
it if the same rule also specifies `.backendRefs` (which Flagger does).

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Patch coverage: 27.02% and project coverage change: -0.32% ⚠️

Comparison is base (aaafdca) 55.28% compared to head (c0e2096) 54.96%.
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1512      +/-   ##
==========================================
- Coverage   55.28%   54.96%   -0.32%     
==========================================
  Files          85       85              
  Lines       10233    10325      +92     
==========================================
+ Hits         5657     5675      +18     
- Misses       3917     3988      +71     
- Partials      659      662       +3     
Files Changed Coverage Δ
pkg/controller/scheduler.go 45.30% <0.00%> (ø)
pkg/controller/scheduler_hooks.go 13.79% <0.00%> (ø)
pkg/router/gateway_api_v1beta1.go 48.36% <7.50%> (-7.42%) ⬇️
pkg/canary/spec.go 84.00% <100.00%> (ø)
pkg/canary/status.go 47.17% <100.00%> (ø)
pkg/controller/webhook.go 69.41% <100.00%> (+5.02%) ⬆️
pkg/router/istio.go 77.57% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aryan9600 aryan9600 merged commit 15ef64e into main Sep 22, 2023
@aryan9600 aryan9600 deleted the gw-filters branch September 22, 2023 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway API - Filters support

3 participants