Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apis/v1alpha2/httproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ type HTTPRequestRedirectFilter struct {
// Support: Core
//
// +optional
Hostname *Hostname `json:"hostname,omitempty"`
Hostname *PreciseHostname `json:"hostname,omitempty"`

// Path defines parameters used to modify the path of the incoming request.
// The modified path is then used to construct the `Location` header. When
Expand Down
16 changes: 16 additions & 0 deletions apis/v1alpha2/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,22 @@ type RouteStatus struct {
// +kubebuilder:validation:Pattern=`^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
type Hostname string

// PreciseHostname is the fully qualified domain name of a network host. This matches
// the RFC 1123 definition of a hostname with 1 notable exception that
// numeric IP addresses are not allowed.
//
// PreciseHostname can be "precise" which is a domain name without the terminating
// dot of a network host (e.g. "foo.example.com").
//
// Note that as per RFC1035 and RFC1123, a *label* must consist of lower case
// alphanumeric characters or '-', and must start and end with an alphanumeric
// character. No other punctuation is allowed.
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
type PreciseHostname string

// Group refers to a Kubernetes Group. It must either be an empty string or a
// RFC 1123 subdomain.
//
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha2/validation/httproute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ func TestValidateHTTPRouteTypeMatchesField(t *testing.T) {
Type: gatewayv1a2.HTTPRouteFilterRequestRedirect,
RequestRedirect: &gatewayv1a2.HTTPRequestRedirectFilter{
Scheme: new(string),
Hostname: new(gatewayv1a2.Hostname),
Hostname: new(gatewayv1a2.PreciseHostname),
Path: &gatewayv1a2.HTTPPathModifier{},
Port: new(gatewayv1a2.PortNumber),
StatusCode: new(int),
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions config/crd/stable/gateway.networking.k8s.io_httproutes.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
name: invalid-backend-port
spec:
rules:
- backendRefs:
- name: my-service
port: 8080
filters:
- type: RequestRedirect
requestRedirect:
hostname: "*.gateway.networking.k8s.io"