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

fix: filter hostnames in HTTPRoute #3180

Merged
merged 6 commits into from
Nov 30, 2022
Merged

Conversation

randmonkey
Copy link
Contributor

@randmonkey randmonkey commented Nov 21, 2022

What this PR does / why we need it:

Which issue this PR fixes:

fixes #3175

Special notes for your reviewer:

According to API specification of gateway APIs, what should do when HTTPRoute does not contain hostnames
but listeners contains hostname is not defined. I think the most reasonable behavior is to match the hostname specified by the listener which the HTTPRoute attached to. When an HTTPRoute is not attached to a listener (has empty parentRef.SectionName), I think the reasonable behavior is to match UNION of all (compatible) listeners in the gateway. If any of the HTTP,HTTPS,TLS listeners has an empty hostname to match any hostname, the hostname in HTTPRoute should be also empty to match any hostname.

Also, gateway API spec tells that when no hostname in HTTPRoute can match hostnames in listeners, the HTTPRoute should not be accepted.

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@randmonkey randmonkey requested a review from a team as a code owner November 21, 2022 09:09
@randmonkey randmonkey temporarily deployed to Configure ci November 21, 2022 09:09 Inactive
@pull-request-size pull-request-size bot added size/M and removed size/S labels Nov 21, 2022
@randmonkey randmonkey temporarily deployed to Configure ci November 21, 2022 09:27 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 21, 2022 09:51 Inactive
@randmonkey randmonkey marked this pull request as draft November 21, 2022 10:59
@randmonkey randmonkey temporarily deployed to Configure ci November 23, 2022 02:51 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 23, 2022 03:15 Inactive
@pull-request-size pull-request-size bot added size/L and removed size/M labels Nov 23, 2022
@randmonkey randmonkey temporarily deployed to Configure ci November 23, 2022 06:37 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 23, 2022 07:01 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 23, 2022 07:01 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 23, 2022 07:39 Inactive
@randmonkey randmonkey marked this pull request as ready for review November 23, 2022 07:44
@randmonkey randmonkey changed the title [WIP] fix: does not filter hosts when no hosts in httproute fix: filter hostnames in HTTPRoute Nov 23, 2022
@randmonkey randmonkey temporarily deployed to Configure ci November 23, 2022 08:07 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 23, 2022 08:07 Inactive
@randmonkey randmonkey self-assigned this Nov 23, 2022
@randmonkey randmonkey added this to the KIC v2.8.0 milestone Nov 23, 2022
@randmonkey randmonkey temporarily deployed to Configure ci November 24, 2022 04:04 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 24, 2022 04:28 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 24, 2022 04:28 Inactive
internal/controllers/gateway/httproute_controller.go Outdated Show resolved Hide resolved
internal/controllers/gateway/httproute_controller.go Outdated Show resolved Hide resolved
internal/controllers/gateway/httproute_controller.go Outdated Show resolved Hide resolved
internal/controllers/gateway/httproute_controller.go Outdated Show resolved Hide resolved
internal/controllers/gateway/route_utils.go Outdated Show resolved Hide resolved
internal/controllers/gateway/route_utils.go Outdated Show resolved Hide resolved
internal/controllers/gateway/route_utils.go Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@randmonkey randmonkey temporarily deployed to Configure ci November 29, 2022 10:38 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 29, 2022 11:02 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 29, 2022 11:02 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 30, 2022 03:44 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 30, 2022 08:28 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 30, 2022 08:56 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 30, 2022 08:56 Inactive
pmalek
pmalek previously approved these changes Nov 30, 2022
@randmonkey randmonkey enabled auto-merge (squash) November 30, 2022 10:13
@randmonkey randmonkey temporarily deployed to Configure ci November 30, 2022 17:39 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 30, 2022 17:42 Inactive
@randmonkey randmonkey temporarily deployed to Configure ci November 30, 2022 18:01 Inactive
@randmonkey randmonkey merged commit 8b25137 into main Nov 30, 2022
@randmonkey randmonkey deleted the fix/httproute_incorrect_host branch November 30, 2022 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Routes incorrectly use hostname from Listener
2 participants