Skip to content

Commit 0544a05

Browse files
committed
Changes HTTPRoute hostname field to be singular
1 parent 206c46a commit 0544a05

File tree

3 files changed

+43
-23
lines changed

3 files changed

+43
-23
lines changed

api/v1alpha1/httproute_types.go

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,24 @@ type HTTPRouteSpec struct {
3434

3535
// HTTPRouteHost is the configuration for a given host.
3636
type HTTPRouteHost struct {
37-
// Hostnames are a list of hosts names that match this host
38-
// block.
37+
// Hostname is the fully qualified domain name of a network host,
38+
// as defined by RFC 3986. Note the following deviations from the
39+
// "host" part of the URI as defined in the RFC:
3940
//
40-
// TODO: RFC link
41-
Hostnames []string `json:"hostnames"`
41+
// 1. IPs are not allowed.
42+
// 2. The `:` delimiter is not respected because ports are not allowed.
43+
//
44+
// Incoming requests are matched against Hostname before processing HTTPRoute
45+
// rules. For example, if the request header contains host: foo.example.com,
46+
// an HTTPRoute with hostname foo.example.com will match. However, an
47+
// HTTPRoute with hostname example.com or bar.example.com will not match.
48+
// If Hostname is unspecified, the Gateway routes all traffic based on
49+
// the specified rules.
50+
//
51+
// Support: Core
52+
//
53+
// +optional
54+
Hostname string `json:"hostname,omitempty"`
4255

4356
// Rules are a list of HTTP matchers, filters and actions.
4457
Rules []HTTPRouteRule `json:"rules"`

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/networking.x.k8s.io_httproutes.yaml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,19 @@ spec:
5858
- kind
5959
- name
6060
type: object
61-
hostnames:
62-
description: "Hostnames are a list of hosts names that match this
63-
host block. \n TODO: RFC link"
64-
items:
65-
type: string
66-
type: array
61+
hostname:
62+
description: "Hostname is the fully qualified domain name of a network
63+
host, as defined by RFC 3986. Note the following deviations from
64+
the \"host\" part of the URI as defined in the RFC: \n 1. IPs
65+
are not allowed. 2. The `:` delimiter is not respected because
66+
ports are not allowed. \n Incoming requests are matched against
67+
Hostname before processing HTTPRoute rules. For example, if the
68+
request header contains host: foo.example.com, an HTTPRoute with
69+
hostname foo.example.com will match. However, an HTTPRoute with
70+
hostname example.com or bar.example.com will not match. If Hostname
71+
is unspecified, the Gateway routes all traffic based on the specified
72+
rules. \n Support: Core"
73+
type: string
6774
rules:
6875
description: Rules are a list of HTTP matchers, filters and actions.
6976
items:
@@ -217,7 +224,6 @@ spec:
217224
type: object
218225
type: array
219226
required:
220-
- hostnames
221227
- rules
222228
type: object
223229
hosts:
@@ -245,12 +251,19 @@ spec:
245251
- kind
246252
- name
247253
type: object
248-
hostnames:
249-
description: "Hostnames are a list of hosts names that match this
250-
host block. \n TODO: RFC link"
251-
items:
252-
type: string
253-
type: array
254+
hostname:
255+
description: "Hostname is the fully qualified domain name of a
256+
network host, as defined by RFC 3986. Note the following deviations
257+
from the \"host\" part of the URI as defined in the RFC: \n
258+
1. IPs are not allowed. 2. The `:` delimiter is not respected
259+
because ports are not allowed. \n Incoming requests are matched
260+
against Hostname before processing HTTPRoute rules. For example,
261+
if the request header contains host: foo.example.com, an HTTPRoute
262+
with hostname foo.example.com will match. However, an HTTPRoute
263+
with hostname example.com or bar.example.com will not match.
264+
If Hostname is unspecified, the Gateway routes all traffic based
265+
on the specified rules. \n Support: Core"
266+
type: string
254267
rules:
255268
description: Rules are a list of HTTP matchers, filters and actions.
256269
items:
@@ -416,7 +429,6 @@ spec:
416429
type: object
417430
type: array
418431
required:
419-
- hostnames
420432
- rules
421433
type: object
422434
type: array

0 commit comments

Comments
 (0)