Skip to content

Add support for RequestMirror filter #3306

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

sjberman
Copy link
Collaborator

Problem: As a user, I want to be able to mirror requests to another backend(s) using the RequestMirror filter on an HTTPRoute or GRPCRoute.

Solution: Add support for the RequestMirror filter, allowing users to mirror requests with HTTPRoutes or GRPCRoutes.

Testing: Manually verified single mirror filter, multiple mirror filter, mirror filter with other filters.

Note: the RequestMirror conformance tests seem to have a bug in 1.2.1 Gateway API, which may be fixed in 1.3. We can hopefully enable them at that point.

Closes #533

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Release notes

If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.

Add support for request mirroring using the RequestMirror filter.

@sjberman sjberman requested a review from a team as a code owner April 17, 2025 16:59
@github-actions github-actions bot added the enhancement New feature or request label Apr 17, 2025
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

Attention: Patch coverage is 91.88312% with 25 lines in your changes missing coverage. Please review.

Project coverage is 86.25%. Comparing base (7477df8) to head (c4c62ce).

Files with missing lines Patch % Lines
internal/mode/static/state/validation/validator.go 0.00% 14 Missing ⚠️
internal/mode/static/state/graph/grpcroute.go 92.92% 6 Missing and 1 partial ⚠️
internal/mode/static/state/graph/backend_refs.go 88.46% 2 Missing and 1 partial ⚠️
...e/static/nginx/config/validation/http_validator.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3306      +/-   ##
==========================================
+ Coverage   86.16%   86.25%   +0.09%     
==========================================
  Files         113      116       +3     
  Lines       11664    11923     +259     
  Branches       62       62              
==========================================
+ Hits        10050    10284     +234     
- Misses       1553     1576      +23     
- Partials       61       63       +2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Problem: As a user, I want to be able to mirror requests to another backend(s) using the RequestMirror filter on an HTTPRoute or GRPCRoute.

Solution: Add support for the RequestMirror filter, allowing users to mirror requests with HTTPRoutes or GRPCRoutes.
@sjberman sjberman force-pushed the feat/request-mirror branch from 63572c7 to c4c62ce Compare April 17, 2025 17:29
RequestMirror: &gatewayv1.HTTPRequestMirrorFilter{},
},
expectErrCount: 0,
name: "valid GRPC filter",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
name: "valid GRPC filter",
name: "valid GRPC mirror filter",

Should this have mirror in it?

// RouteName builds the name for the internal mirror route, using the user route name,
// service namespace/name, and index of the rule.
// The prefix is used to prevent a user from creating a route with a conflicting name.
func RouteName(routeName, service string, namespace *string, idx int) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

In the edge case where the namespace is not defined, but the service name ends with "-(insert namespace of another route)", does that matter?

And I guess this works in any case where resource generate identical names when they're not meant to.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah good catch. This is where naming these things gets tough. I'll have to figure out how to structure this to avoid those edge cases...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request release-notes
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

HTTP Request Mirror
2 participants