Skip to content

Conversation

danehans
Copy link
Contributor

Previously the hostname of a HTTPRouteHost was plural. This PR singularizes the field and adds more detailed godocs.

Note: The RFC 3986 requirement is carried over from IngressRule v1beta1.

/assign @bowei
/cc @ironcladlou @Miciah

@k8s-ci-robot
Copy link
Contributor

@danehans: GitHub didn't allow me to request PR reviews from the following users: ironcladlou, Miciah.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

Previously the hostname of a HTTPRouteHost was plural. This PR singularizes the field and adds more detailed godocs.

Note: The RFC 3986 requirement is carried over from IngressRule v1beta1.

/assign @bowei
/cc @ironcladlou @Miciah

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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 15, 2020
@bowei
Copy link
Contributor

bowei commented Jan 15, 2020

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 15, 2020
@bowei
Copy link
Contributor

bowei commented Jan 15, 2020

Copy link
Contributor

@Miciah Miciah left a comment

Choose a reason for hiding this comment

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

What is the motivation for singularizing Hostnames? Is it because Hosts in HTTPRouteSpec is already plural?

// TODO: RFC link
Hostnames []string `json:"hostnames"`
// 1. IPs are not allowed.
// 2. The `:` delimiter is not respected because ports are not allowed.
Copy link
Contributor

Choose a reason for hiding this comment

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

port is in authority but not in host.

//
// TODO: RFC link
Hostnames []string `json:"hostnames"`
// 1. IPs are not allowed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be simpler to say that the value must be a reg-name per RFC 3986?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think stating "IPs are not allowed" will make sense to most, if not all, users. I just spent a few minutes reviewing https://tools.ietf.org/html/rfc3986 and I still don't understand what a reg-name is. Maybe we can iterate on the godoc for this field to include reg-name?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is useful to state explicitly that IP addresses are prohibited, fair enough. I think referencing the specific syntax item is also useful. From the RFC:

 host          = IP-literal / IPv4address / reg-name
 reg-name      = *( unreserved / pct-encoded / sub-delims )
 pct-encoded   = "%" HEXDIG HEXDIG
 unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
 sub-delims    = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="

//
// Incoming requests are matched against Hostname before processing HTTPRoute
// rules. If Hostname is unspecified, the Gateway routes all traffic based on
// the specified rules.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does Hostname need to be unique among HTTPRoute resources?

How does SNI fit in? I would guess that for a TLS connection, first some certificate must match, and then the ingress controller uses the first route that also matches?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does Hostname need to be unique among HTTPRoute resources?

@Miciah this is a good point. @bowei do you agree that the value should be unique?. I don't see any mention of this in the ingress v1beta api docs.

How does SNI fit in? I would guess that for a TLS connection, first some certificate must match, and then the ingress controller uses the first route that also matches?

I would expect similar behavior as ingress v1beta1. From the ingress docs:

If the TLS configuration section in an Ingress specifies different hosts, they are multiplexed on the same port according to the hostname specified through the SNI TLS extension (provided the Ingress controller supports SNI).

Translating the above doc to ingress v2, I would expect the following flow for ingress https connections:

  1. The client initiates a connection to the HTTPRoute hostname.
  2. The client resolves the HTTPRoute hostname to an IP address of the binding Gateway.
  3. The connection hits the binding Gateway TLS listener (default 443).
  4. The Gateway uses the SNI hostname to match the correct HTTPRoute
  5. The Gateway processes the HTTPRoute rules and creates a corresponding connection to the backend service or endpoint associated to the service.

@bowei feel free to chime in if ^ is incorrect. It would also be helpful to understand if the Gateway implementation would forward directly to an endpoint to bypass kube-proxy or to the Service IP. Maybe this is up to the Gateway implementation?

Copy link

@szuecs szuecs Jan 15, 2020

Choose a reason for hiding this comment

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

Why do we need to singularize the hostname?
There’s a use case for having multiple hostnames in one endpoint, for example multi language site through example.TLD.
A client can select to one or the other hostname and the developer wants not to duplicate her Rules. If we singularize we need to duplicate the Rules.
I don’t see any blockers to not support it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be singular but no unique.
Some use-cases create multiple routes with the same hosts but different paths (or other HTTP metadata). And these routes can belong to different teams.

Translating the above doc to ingress v2, I would expect the following flow for ingress https connections:

TLS and Routing details should not be clubbed together. Although, there is leakage between the layers of the OSI model, they are largely different layers. @danehans, in your description, I think Step 2 and 3 should be changed. HTTPRoute can't be resolved until after TLS is done. One can use only the TLS config setting of a route, but shouldn't select that route. Route selection is based on other metadata in the HTTP reqeust.

Regarding, Sandor's point, I think this can be opened up to allow for prefix and suffix wildcards in future if there is a need for it.

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 case of HTTPRoutes, the gateway can terminate TLS and then use HTTP to select a HTTPRoute, but in the case of a TCPRoute, HTTP headers are unavailable. So faced with an incoming TLS request, the gateway could first use SNI to build a set of candidate routes, which must comprise either multiple HTTPRoutes or a single TCPRoute, and then the gateway could either (a) terminate TLS and use HTTP metadata to select a single HTTPRoute or (b) use the TLSRoute.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think Step 2 and 3 should be changed

@haiyanmeng I submitted #68 to doc a typical ingress request flow, ptal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Reference for uniqueness: #67

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm inclined to merge this and continue conversation about the wildcard on an issue specific to having wildcards.

Copy link
Contributor

Choose a reason for hiding this comment

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

I extracted the use case that @szuecs raised into #80.

@danehans
Copy link
Contributor Author

What is the motivation for singularizing Hostnames? Is it because Hosts in HTTPRouteSpec is already plural?

@Miciah ptal at #43 (comment) for add'l background.

@danehans danehans changed the title Changes HTTPRoute hostname field to be singular Singularizes and expands godocs of HTTPRoute hostname Feb 10, 2020
@danehans danehans force-pushed the gw_single_host branch 2 times, most recently from 4e3a916 to 60d480d Compare February 10, 2020 19:11
@bowei
Copy link
Contributor

bowei commented Feb 14, 2020

I think most of the issues raised above are captured in the ongoing discussions on the issues, so we can merge this.

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bowei, danehans

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

@bowei
Copy link
Contributor

bowei commented Feb 14, 2020

Please open an issue if you don't see something that should be tracked.

@k8s-ci-robot k8s-ci-robot merged commit ef7cd09 into kubernetes-sigs:master Feb 14, 2020
jaison-tiu pushed a commit to jaison-tiu/gateway-api that referenced this pull request Apr 14, 2022
…-docs-reference-manifests

updating multi-cluster-gateway docs manifests
@mikemorris mikemorris mentioned this pull request Oct 2, 2025
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants