Match HTTPRoutes on headers, query params, and method#122
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Gateway API provider only honored
matches[].path— a rule'sheaders,queryParams, andmethodconditions were ignored, so a route meant to match onlyGETrequests carryingX-Canary: yeswas served for every request on its hostname. This wires those three match dimensions through to the entrypoint model.What changed
matches[].headers[],matches[].queryParams[], andmatches[].methodare now translated inrule_to_entrypoints. Within a match they are ANDed with the path (and each other); across matches they stay ORed (each match already fans out into its own entrypoint).match_headers/match_query/methodsonEntrypointConfig, the same fields the Docker/label and YAML providers already populate, so enforcement is shared: header/query are checked by the request-match middleware (404 on a miss), methods are enforced natively by Sōzu (one frontend per verb).type: RegularExpressionhas no faithful representation in the exact/presence model. Rather than serve the route with the regex condition silently dropped (routing more traffic than the author asked for), the whole route is rejected withResolvedRefs=False reason=UnsupportedValue, mirroring how unsupported filters are handled. Exact and presence-only header/query matches, and all nine method verbs, are supported.gateway_matches.rsmodule holds the pure translators + the unsupported-condition check, alongside the existinggateway_filters.rs.Tests
02-gateway.sh+gateway-manifests.yaml): a header+method route serves only aGETwithX-Canary: yes(200) and 404s a GET without the header and a POST with it; a query-param route serves only?debug=1. Verified end-to-end on kind against a local image build: 33 passed, 0 failed.cargo fmt --check,clippyclean; full unit suite 686 passed.Docs
HTTPRoute support list in the Kubernetes provider docs updated with the new match dimensions and the regex-rejection behavior.