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

Clarify port redirect behaviour and add conformance tests for the same #1880

Merged
merged 4 commits into from
May 9, 2023

Conversation

gauravkghildiyal
Copy link
Member

@gauravkghildiyal gauravkghildiyal commented Mar 27, 2023

What type of PR is this?

/kind documentation
/area conformance
/kind test

What this PR does / why we need it:

Clarify port redirect behaviour and add conformance tests for the same:

// When empty, the redirect port MUST be derived using the following rules:
//
// * If redirect scheme is not-empty, the redirect port MUST be the well-known
//   port associated with the redirect scheme. Specifically "http" to port 80
//   and "https" to port 443. If the redirect scheme does not have a
//   well-known port, the listener port of the Gateway SHOULD be used.
// * If redirect scheme is empty, the redirect port MUST be the Gateway
//   Listener port.

Proposal doc: https://docs.google.com/document/d/1fx8kuWh2bmBge9IRGn7NlhGqTP0Kj21Cz5RZyUW6428

Which issue(s) this PR fixes:

Fixes #1805
Fixes #1909

Does this PR introduce a user-facing change?:

Port redirect when empty will depend on the configured Redirect scheme

@k8s-ci-robot k8s-ci-robot added area/conformance kind/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 27, 2023
@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 27, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @gauravkghildiyal. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@robscott
Copy link
Member

Thanks @gauravkghildiyal!

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 27, 2023
@robscott robscott added this to the v0.7.0 milestone Mar 27, 2023
@shaneutt shaneutt added the release-blocker MUST be completed to complete the milestone label Mar 29, 2023
Copy link
Contributor

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

One more small change from me, then this LGTM.

conformance/utils/http/http.go Outdated Show resolved Hide resolved
@howardjohn
Copy link
Contributor

As far as I can tell this cannot currently be implemented by Envoy as is, meaning most implementations cannot be conformant. Envoy has 2 modes:

  • Set explicit port
  • Derive port from Host

But we have a test that Host: ip:80 results in Location: http://ip. Envoy doesn't have a way to say "set no port", as far as I can tell?

I think we need either envoyproxy/envoy#25573 or envoyproxy/envoy#26516

@arkodg
Copy link
Contributor

arkodg commented Apr 3, 2023

As far as I can tell this cannot currently be implemented by Envoy as is, meaning most implementations cannot be conformant. Envoy has 2 modes:

  • Set explicit port
  • Derive port from Host

But we have a test that Host: ip:80 results in Location: http://ip. Envoy doesn't have a way to say "set no port", as far as I can tell?

I think we need either envoyproxy/envoy#25573 or envoyproxy/envoy#26516

The simplest way for to make some progress now would be to set Host: ip instead of Host: ip:80 when sending requests for this test ?

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 8, 2023
Copy link
Contributor

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 9, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gauravkghildiyal, howardjohn, youngnick

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@robscott
Copy link
Member

robscott commented May 9, 2023

Will wait until tomorrow to remove the hold, but this LGTM as well. Thanks for all the work on this @gauravkghildiyal!

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 9, 2023
@shaneutt shaneutt requested a review from mlavacca May 9, 2023 15:07
@robscott
Copy link
Member

robscott commented May 9, 2023

Thanks to everyone for the quick reviews and feedback on this and to @gauravkghildiyal for the great work here! This was discussed at both Gateway API and GAMMA meetings this week and no significant blockers came up. Going to go ahead and merge and transition to RC2 prep.

/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 9, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 9, 2023
@k8s-ci-robot k8s-ci-robot merged commit 2d1f9c5 into kubernetes-sigs:main May 9, 2023
@gauravkghildiyal gauravkghildiyal deleted the port-redirect branch May 10, 2023 03:20
bartsmykla added a commit to bartsmykla/kuma that referenced this pull request Mar 20, 2024
According to kubernetes-sigs/gateway-api#1880

// When empty, the redirect port MUST be derived using the following rules:
//
// * If redirect scheme is not-empty, the redirect port MUST be the well-known
//   port associated with the redirect scheme. Specifically "http" to port 80
//   and "https" to port 443. If the redirect scheme does not have a
//   well-known port, the listener port of the Gateway SHOULD be used.
// * If redirect scheme is empty, the redirect port MUST be the Gateway
//   Listener port.

Signed-off-by: Bart Smykla <bartek@smykla.com>
bartsmykla added a commit to kumahq/kuma that referenced this pull request Mar 20, 2024
…formant (#9669)

fix(GatewayAPI): make MeshHTTPRoute conversion port redirect conformant

According to kubernetes-sigs/gateway-api#1880

> When empty, the redirect port MUST be derived using the following rules:
>
> * If redirect scheme is not-empty, the redirect port MUST be the well-known
>   port associated with the redirect scheme. Specifically "http" to port 80
>   and "https" to port 443. If the redirect scheme does not have a
>   well-known port, the listener port of the Gateway SHOULD be used.
> * If redirect scheme is empty, the redirect port MUST be the Gateway
>   Listener port.

Signed-off-by: Bart Smykla <bartek@smykla.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/conformance cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/documentation Categorizes issue or PR as related to documentation. kind/test lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-blocker MUST be completed to complete the milestone size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
No open projects