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

gatewayapi: fix buildHTTPVirtualServices match order #50109

Closed
wants to merge 1 commit into from

Conversation

zirain
Copy link
Member

@zirain zirain commented Mar 26, 2024

Please provide a description of this PR:

fix: #50108

@zirain zirain requested a review from a team as a code owner March 26, 2024 15:52
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 26, 2024
Copy link
Contributor

@keithmattix keithmattix left a comment

Choose a reason for hiding this comment

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

Great catch; thanks for the fix! LGTM after tests pass

releasenotes/notes/50109.yaml Outdated Show resolved Hide resolved
@zirain zirain requested a review from howardjohn March 27, 2024 07:30
@zirain zirain added cherrypick/release-1.20 Set this label on a PR to auto-merge it to the release-1.20 branch cherrypick/release-1.21 Set this label on a PR to auto-merge it to the release-1.21 branch labels Mar 27, 2024
@zirain
Copy link
Member Author

zirain commented Apr 4, 2024

/retest

@zirain
Copy link
Member Author

zirain commented Apr 4, 2024

kindly ping @howardjohn

@zirain zirain closed this Apr 4, 2024
@zirain zirain reopened this Apr 6, 2024
@zirain zirain requested a review from a team as a code owner April 6, 2024 05:50
@@ -799,6 +799,12 @@ func getURIRank(match *istio.HTTPMatchRequest) int {
if match.Uri == nil {
return -1
}

// catch all route should be the lowest priority
if isCatchAll(match) {
Copy link
Member Author

Choose a reason for hiding this comment

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

special handler for catch all rout
cc @howardjohn

Copy link
Member

Choose a reason for hiding this comment

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

This seems odd to.

  1. This function is giving the rank of the URI match. Why is a URI match looking at method, headers, query param.
  2. Why does sortHTTPRoutes not already account for 'catch all' implicitly? It should make less exact matches lowest priority. Why is that not already happening?

Copy link
Member Author

Choose a reason for hiding this comment

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

This function is giving the rank of the URI match. Why is a URI match looking at method, headers, query param.

most likely share same logic as func IsCatchAllRoute(r *route.Route) bool {

Why does sortHTTPRoutes not already account for 'catch all' implicitly? It should make less exact matches lowest priority. Why is that not already happening?

The match order from comment is Exact -> Prefix -> Regex.
if we didn't handle catch all, any Prefix or Regex match will be ignored when istio start to translator to xds after sorting.

@@ -799,6 +799,12 @@ func getURIRank(match *istio.HTTPMatchRequest) int {
if match.Uri == nil {
return -1
}

// catch all route should be the lowest priority
if isCatchAll(match) {
Copy link
Member

Choose a reason for hiding this comment

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

This seems odd to.

  1. This function is giving the rank of the URI match. Why is a URI match looking at method, headers, query param.
  2. Why does sortHTTPRoutes not already account for 'catch all' implicitly? It should make less exact matches lowest priority. Why is that not already happening?

@istio-policy-bot istio-policy-bot added the lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while label May 9, 2024
@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label May 10, 2024
@istio-testing
Copy link
Collaborator

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@istio-policy-bot
Copy link

🚧 This issue or pull request has been closed due to not having had activity from an Istio team member since 2024-04-08. If you feel this issue or pull request deserves attention, please reopen the issue. Please see this wiki page for more information. Thank you for your contributions.

Created by the issue and PR lifecycle manager.

@istio-policy-bot istio-policy-bot added the lifecycle/automatically-closed Indicates a PR or issue that has been closed automatically. label May 24, 2024
@zirain zirain reopened this May 24, 2024
@zirain zirain reopened this May 24, 2024
@istio-testing
Copy link
Collaborator

istio-testing commented May 24, 2024

@zirain: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
integ-security_istio 8b0f663 link true /test integ-security
integ-basic-arm64_istio 8b0f663 link true /test integ-basic-arm64
unit-tests-arm64_istio 8b0f663 link true /test unit-tests-arm64
integ-ds_istio 8b0f663 link true /test integ-ds
integ-distroless_istio 8b0f663 link true /test integ-distroless
integ-cni_istio 8b0f663 link true /test integ-cni
integ-ambient_istio 8b0f663 link true /test integ-ambient
integ-helm_istio 8b0f663 link true /test integ-helm
gencheck_istio 8b0f663 link true /test gencheck
integ-ipv6_istio 8b0f663 link true /test integ-ipv6
integ-pilot-istiodremote_istio 8b0f663 link true /test integ-pilot-istiodremote
integ-operator-controller_istio 8b0f663 link true /test integ-operator-controller
integ-pilot-istiodremote-mc_istio 8b0f663 link true /test integ-pilot-istiodremote-mc
integ-pilot-multicluster_istio 8b0f663 link true /test integ-pilot-multicluster
integ-pilot_istio 8b0f663 link true /test integ-pilot
integ-telemetry_istio 8b0f663 link true /test integ-telemetry
integ-telemetry-mc_istio 8b0f663 link true /test integ-telemetry-mc
integ-security-istiodremote_istio 8b0f663 link true /test integ-security-istiodremote

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@zirain zirain removed lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while lifecycle/automatically-closed Indicates a PR or issue that has been closed automatically. labels May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking cherrypick/release-1.20 Set this label on a PR to auto-merge it to the release-1.20 branch cherrypick/release-1.21 Set this label on a PR to auto-merge it to the release-1.21 branch needs-rebase Indicates a PR needs to be rebased before being merged size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gatewayapi: match rule was ignored
8 participants