@@ -10,6 +10,46 @@ import (
1010
1111// HTTPProxySpec defines the desired state of HTTPProxy.
1212type HTTPProxySpec struct {
13+
14+ // Hostnames defines a set of hostnames that should match against the HTTP
15+ // Host header to select a HTTPProxy used to process the request.
16+ //
17+ // Valid values for Hostnames are determined by RFC 1123 definition of a
18+ // hostname with 1 notable exception:
19+ //
20+ // 1. IPs are not allowed.
21+ //
22+ // Hostnames must be verified before being programmed. This is accomplished
23+ // via the use of `Domain` resources. A hostname is considered verified if any
24+ // verified `Domain` resource exists in the same namespace where the
25+ // `spec.domainName` of the resource either exactly matches the hostname, or
26+ // is a suffix match of the hostname. That means that a Domain with a
27+ // `spec.domainName` of `example.com` will match a hostname of
28+ // `test.example.com`, `foo.test.example.com`, and exactly `example.com`, but
29+ // not a hostname of `test-example.com`. If a `Domain` resource does not exist
30+ // that matches a hostname, one will automatically be created when the system
31+ // attempts to program the HTTPProxy.
32+ //
33+ // In addition to verifying ownership, hostnames must be unique across the
34+ // platform. If a hostname is already programmed on another resource, a
35+ // conflict will be encountered and communicated in the `HostnamesVerified`
36+ // condition.
37+ //
38+ // Hostnames which have been programmed will be listed in the
39+ // `status.hostnames` field. Any hostname which has not been programmed will
40+ // be listed in the `message` field of the `HostnamesVerified` condition with
41+ // an indication as to why it was not programmed.
42+ //
43+ // The system may automatically generate and associate hostnames with the
44+ // HTTPProxy. In such cases, these will be listed in the `status.hostnames`
45+ // field and do not require additional configuration by the user.
46+ //
47+ // Wildcard hostnames are not supported at this time.
48+ //
49+ // +kubebuilder:validation:Optional
50+ // +kubebuilder:validation:MaxItems=16
51+ Hostnames []gatewayv1.Hostname `json:"hostnames,omitempty"`
52+
1353 // Rules are a list of HTTP matchers, filters and actions.
1454 //
1555 // +kubebuilder:validation:Required
@@ -107,7 +147,7 @@ type HTTPProxyStatus struct {
107147 // Hostnames lists the hostnames that have been bound to the HTTPProxy.
108148 //
109149 // If this list does not match that defined in the HTTPProxy, see the
110- // `Programmed ` condition message for details.
150+ // `HostnamesVerified ` condition message for details.
111151 Hostnames []gatewayv1.Hostname `json:"hostnames,omitempty"`
112152
113153 // Conditions describe the current conditions of the HTTPProxy.
@@ -126,6 +166,14 @@ const (
126166 // programmed into underlying Gateway resources, and those resources have also
127167 // been programmed.
128168 HTTPProxyConditionProgrammed = "Programmed"
169+
170+ // This condition is true when all hostnames defined in an HTTPProxy or a
171+ // Gateway listener have been verified.
172+ HTTPProxyConditionHostnamesVerified = "HostnamesVerified"
173+
174+ // This condition is present and true when a hostname defined in an HTTPProxy
175+ // is in use by another resource.
176+ HTTPProxyConditionHostnamesInUse = "HostnamesInUse"
129177)
130178
131179const (
@@ -144,6 +192,18 @@ const (
144192 // conditions when the status is "Unknown" and no controller has reconciled
145193 // the HTTPProxy.
146194 HTTPProxyReasonPending = "Pending"
195+
196+ // This reason is used with the "HostnamesVerified" condition when all hostnames
197+ // defined in an HTTPProxy or Gateway listener have been verified.
198+ HTTPProxyReasonHostnamesVerified = "HostnamesVerified"
199+
200+ // This reason is used with the a hostname defined in an HTTPProxy or Gateway
201+ // has not been verified.
202+ UnverifiedHostnamesPresent = "UnverifiedHostnamesPresent"
203+
204+ // This reason is used with the a hostname defined in an HTTPProxy or Gateway
205+ // is in use by another resource.
206+ HostnameInUseReason = "HostnameInUse"
147207)
148208
149209// +kubebuilder:object:root=true
0 commit comments