diff --git a/apis/v1alpha2/httproute_types.go b/apis/v1alpha2/httproute_types.go index 3c1f1f2b96..b8ec846480 100644 --- a/apis/v1alpha2/httproute_types.go +++ b/apis/v1alpha2/httproute_types.go @@ -240,14 +240,19 @@ type HTTPRouteRule struct { // +kubebuilder:validation:MaxItems=16 Filters []HTTPRouteFilter `json:"filters,omitempty"` - // ForwardTo defines the backend(s) where matching requests should be sent. - // If unspecified, the rule performs no forwarding. If unspecified and no - // filters are specified that would result in a response being sent, a 503 - // error code is returned. + // BackendRefs defines the backend(s) where matching requests should be + // sent. If unspecified, the rule performs no forwarding. If unspecified and + // no filters are specified that would result in a response being sent, + // a HTTP 503 status code is returned. + // + // Support: Core for Kubernetes Service + // Support: Custom for any other resource + // + // Support for weight: Core // // +optional // +kubebuilder:validation:MaxItems=16 - ForwardTo []HTTPRouteForwardTo `json:"forwardTo,omitempty"` + BackendRefs []HTTPBackendRef `json:"backendRefs,omitempty"` } // PathMatchType specifies the semantics of how HTTP paths should be compared. @@ -563,7 +568,7 @@ const ( // // Support in HTTPRouteRule: Core // - // Support in HTTPRouteForwardTo: Extended + // Support in HTTPBackendRef: Extended HTTPRouteFilterRequestHeaderModifier HTTPRouteFilterType = "RequestHeaderModifier" // HTTPRouteFilterRequestRedirect can be used to redirect a request to @@ -572,7 +577,7 @@ const ( // // Support in HTTPRouteRule: Core // - // Support in HTTPRouteForwardTo: Extended + // Support in HTTPBackendRef: Extended HTTPRouteFilterRequestRedirect HTTPRouteFilterType = "RequestRedirect" // HTTPRouteFilterRequestMirror can be used to mirror HTTP requests to a @@ -581,7 +586,7 @@ const ( // // Support in HTTPRouteRule: Extended // - // Support in HTTPRouteForwardTo: Extended + // Support in HTTPBackendRef: Extended HTTPRouteFilterRequestMirror HTTPRouteFilterType = "RequestMirror" // HTTPRouteFilterExtensionRef should be used for configuring custom @@ -589,7 +594,7 @@ const ( // // Support in HTTPRouteRule: Custom // - // Support in HTTPRouteForwardTo: Custom + // Support in HTTPBackendRef: Custom HTTPRouteFilterExtensionRef HTTPRouteFilterType = "ExtensionRef" ) @@ -716,112 +721,30 @@ type HTTPRequestRedirect struct { // HTTPRequestMirrorFilter defines configuration for the RequestMirror filter. type HTTPRequestMirrorFilter struct { - // ServiceName refers to the name of the Service to mirror matched requests - // to. When specified, this takes the place of BackendRef. If both - // BackendRef and ServiceName are specified, ServiceName will be given - // precedence. + // BackendRef references a resource where mirrored requests are sent. // // If the referent cannot be found, the rule is not included in the route. // The controller should raise the "ResolvedRefs" condition on the Gateway // with the "DegradedRoutes" reason. The gateway status for this route should // be updated with a condition that describes the error more specifically. // - // Support: Core + // Support: Extended for Kubernetes Service + // Support: Custom for any other resource // // +optional - // +kubebuilder:validation:MaxLength=253 - ServiceName *string `json:"serviceName,omitempty"` + BackendRef *BackendObjectReference `json:"backendRef,omitempty"` +} - // BackendRef is a local object reference to mirror matched requests to. If - // both BackendRef and ServiceName are specified, ServiceName will be given - // precedence. +// HTTPBackendRef defines how a HTTPRoute should forward an HTTP request. +type HTTPBackendRef struct { + // BackendRef defines how a Route should forward a request to a Kubernetes + // resource. // // If the referent cannot be found, the rule is not included in the route. // The controller should raise the "ResolvedRefs" condition on the Gateway // with the "DegradedRoutes" reason. The gateway status for this route should // be updated with a condition that describes the error more specifically. - // - // Support: Custom - // - // +optional - BackendRef *LocalObjectReference `json:"backendRef,omitempty"` - - // Port specifies the destination port number to use for the - // backend referenced by the ServiceName or BackendRef field. - // - // If unspecified, the destination port in the request is used - // when forwarding to a backendRef or serviceName. - // - // +optional - Port *PortNumber `json:"port,omitempty"` -} - -// HTTPRouteForwardTo defines how a HTTPRoute should forward a request. -type HTTPRouteForwardTo struct { - // ServiceName refers to the name of the Service to forward matched requests - // to. When specified, this takes the place of BackendRef. If both - // BackendRef and ServiceName are specified, ServiceName will be given - // precedence. - // - // If the referent cannot be found, the route must be dropped - // from the Gateway. The controller should raise the "ResolvedRefs" - // condition on the Gateway with the "DegradedRoutes" reason. - // The gateway status for this route should be updated with a - // condition that describes the error more specifically. - // - // The protocol to use should be specified with the AppProtocol field on - // Service resources. - // - // Support: Core - // - // +optional - // +kubebuilder:validation:MaxLength=253 - ServiceName *string `json:"serviceName,omitempty"` - - // BackendRef is a reference to a backend to forward matched requests to. If - // both BackendRef and ServiceName are specified, ServiceName will be given - // precedence. - // - // If the referent cannot be found, the route must be dropped - // from the Gateway. The controller should raise the "ResolvedRefs" - // condition on the Gateway with the "DegradedRoutes" reason. - // The gateway status for this route should be updated with a - // condition that describes the error more specifically. - // - // Support: Custom - // - // +optional - BackendRef *LocalObjectReference `json:"backendRef,omitempty"` - - // Port specifies the destination port number to use for the - // backend referenced by the ServiceName or BackendRef field. - // If unspecified, the destination port in the request is used - // when forwarding to a backendRef or serviceName. - // - // Support: Core - // - // +optional - Port *PortNumber `json:"port,omitempty"` - - // Weight specifies the proportion of HTTP requests forwarded to the backend - // referenced by the ServiceName or BackendRef field. This is computed as - // weight/(sum of all weights in this ForwardTo list). For non-zero values, - // there may be some epsilon from the exact proportion defined here - // depending on the precision an implementation supports. Weight is not a - // percentage and the sum of weights does not need to equal 100. - // - // If only one backend is specified and it has a weight greater than 0, 100% - // of the traffic is forwarded to that backend. If weight is set to 0, - // traffic must not be forwarded for this entry. If unspecified, weight - // defaults to 1. - // - // Support: Core - // - // +optional - // +kubebuilder:default=1 - // +kubebuilder:validation:Minimum=0 - // +kubebuilder:validation:Maximum=1000000 - Weight *int32 `json:"weight,omitempty"` + BackendRef `json:",inline"` // Filters defined at this-level should be executed if and only if the // request is being forwarded to the backend defined here. diff --git a/apis/v1alpha2/shared_types.go b/apis/v1alpha2/shared_types.go index 2fc3742048..bdbc7abc1c 100644 --- a/apis/v1alpha2/shared_types.go +++ b/apis/v1alpha2/shared_types.go @@ -77,53 +77,49 @@ type GatewayReference struct { Namespace string `json:"namespace"` } -// RouteForwardTo defines how a Route should forward a request. -type RouteForwardTo struct { - // ServiceName refers to the name of the Service to forward matched requests - // to. When specified, this takes the place of BackendRef. If both - // BackendRef and ServiceName are specified, ServiceName will be given - // precedence. - // - // If the referent cannot be found, the rule is not included in the route. - // The controller should raise the "ResolvedRefs" condition on the Gateway - // with the "DegradedRoutes" reason. The gateway status for this route should - // be updated with a condition that describes the error more specifically. - // - // The protocol to use should be specified with the AppProtocol field on - // Service resources. - // - // Support: Core +// BackendObjectReference defines how an ObjectReference that is +// specific to BackendRef. It includes a few additional fields and features +// than a regular ObjectReference. +type BackendObjectReference struct { + // Group is the group of the referent. + // When unspecified (empty string), core API group is inferred. // // +optional + // +kubebuilder:default="" // +kubebuilder:validation:MaxLength=253 - ServiceName *string `json:"serviceName,omitempty"` + Group *string `json:"group"` - // BackendRef is a reference to a backend to forward matched requests to. If - // both BackendRef and ServiceName are specified, ServiceName will be given - // precedence. - // - // If the referent cannot be found, the rule is not included in the route. - // The controller should raise the "ResolvedRefs" condition on the Gateway - // with the "DegradedRoutes" reason. The gateway status for this route should - // be updated with a condition that describes the error more specifically. - // - // Support: Custom + // Kind is kind of the referent. // // +optional - BackendRef *LocalObjectReference `json:"backendRef,omitempty"` + // +kubebuilder:default=Service + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=253 + Kind *string `json:"kind"` - // Port specifies the destination port number to use for the - // backend referenced by the ServiceName or BackendRef field. - // If unspecified, the destination port in the request is used - // when forwarding to a backendRef or serviceName. + // Name is the name of the referent. // - // Support: Core + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=253 + Name string `json:"name"` + + // Port specifies the destination port number to use for this resource. + // Port is required when the referent is a Kubernetes Service. + // For other resources, destination port can be derived from the referent + // resource or this field. // // +optional Port *PortNumber `json:"port,omitempty"` +} + +// BackendRef defines how a Route should forward a request to a Kubernetes +// resource. +type BackendRef struct { + // BackendObjectReference references a Kubernetes object. + BackendObjectReference `json:",inline"` - // Weight specifies the proportion of HTTP requests forwarded to the backend - // referenced by the ServiceName or BackendRef field. This is computed as + // Weight specifies the proportion of HTTP requests forwarded to the + // referenced backend. This is computed as // weight/(sum of all weights in this ForwardTo list). For non-zero values, // there may be some epsilon from the exact proportion defined here // depending on the precision an implementation supports. Weight is not a @@ -134,7 +130,7 @@ type RouteForwardTo struct { // traffic should be forwarded for this entry. If unspecified, weight // defaults to 1. // - // Support: Extended + // Support for this field varies based on the context where used. // // +optional // +kubebuilder:default=1 diff --git a/apis/v1alpha2/tcproute_types.go b/apis/v1alpha2/tcproute_types.go index 4515c0913e..c561a4a1fd 100644 --- a/apis/v1alpha2/tcproute_types.go +++ b/apis/v1alpha2/tcproute_types.go @@ -92,12 +92,17 @@ type TCPRouteRule struct { // +kubebuilder:validation:MaxItems=8 Matches []TCPRouteMatch `json:"matches,omitempty"` - // ForwardTo defines the backend(s) where matching requests should - // be sent. + // BackendRefs defines the backend(s) where matching requests should be + // sent. + // + // Support: Core for Kubernetes Service + // Support: Custom for any other resource + // + // Support for weight: Extended // // +kubebuilder:validation:MinItems=1 // +kubebuilder:validation:MaxItems=16 - ForwardTo []RouteForwardTo `json:"forwardTo"` + BackendRefs []BackendRef `json:"backendRefs,omitempty"` } // TCPRouteMatch defines the predicate used to match connections to a diff --git a/apis/v1alpha2/tlsroute_types.go b/apis/v1alpha2/tlsroute_types.go index 8ab5165991..e36ebcf333 100644 --- a/apis/v1alpha2/tlsroute_types.go +++ b/apis/v1alpha2/tlsroute_types.go @@ -127,12 +127,17 @@ type TLSRouteRule struct { // +kubebuilder:validation:MaxItems=8 Matches []TLSRouteMatch `json:"matches,omitempty"` - // ForwardTo defines the backend(s) where matching requests should be + // BackendRefs defines the backend(s) where matching requests should be // sent. // + // Support: Core for Kubernetes Service + // Support: Custom for any other resource + // + // Support for weight: Extended + // // +kubebuilder:validation:MinItems=1 // +kubebuilder:validation:MaxItems=16 - ForwardTo []RouteForwardTo `json:"forwardTo"` + BackendRefs []BackendRef `json:"backendRefs,omitempty"` } // TLSRouteMatch defines the predicate used to match connections to a diff --git a/apis/v1alpha2/udproute_types.go b/apis/v1alpha2/udproute_types.go index 7a18331d2e..a393efa25c 100644 --- a/apis/v1alpha2/udproute_types.go +++ b/apis/v1alpha2/udproute_types.go @@ -92,12 +92,17 @@ type UDPRouteRule struct { // +kubebuilder:validation:MaxItems=8 Matches []UDPRouteMatch `json:"matches,omitempty"` - // ForwardTo defines the backend(s) where matching requests should - // be sent. + // BackendRefs defines the backend(s) where matching requests should be + // sent. + // + // Support: Core for Kubernetes Service + // Support: Custom for any other resource + // + // Support for weight: Extended // // +kubebuilder:validation:MinItems=1 // +kubebuilder:validation:MaxItems=16 - ForwardTo []RouteForwardTo `json:"forwardTo"` + BackendRefs []BackendRef `json:"backendRefs,omitempty"` } // UDPRouteMatch defines the predicate used to match packets to a diff --git a/apis/v1alpha2/validation/httproute_test.go b/apis/v1alpha2/validation/httproute_test.go index bd76d38c0d..db22fbd92e 100644 --- a/apis/v1alpha2/validation/httproute_test.go +++ b/apis/v1alpha2/validation/httproute_test.go @@ -46,11 +46,15 @@ func TestValidateHTTPRoute(t *testing.T) { }, }, }, - ForwardTo: []gatewayv1a2.HTTPRouteForwardTo{ + BackendRefs: []gatewayv1a2.HTTPBackendRef{ { - ServiceName: &testService, - Port: portNumberPtr(8080), - Weight: utilpointer.Int32(100), + BackendRef: gatewayv1a2.BackendRef{ + BackendObjectReference: gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: portNumberPtr(8080), + }, + Weight: utilpointer.Int32(100), + }, }, }, }, @@ -77,8 +81,10 @@ func TestValidateHTTPRoute(t *testing.T) { { Type: gatewayv1a2.HTTPRouteFilterRequestMirror, RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ - ServiceName: &testService, - Port: portNumberPtr(8081), + BackendRef: &gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: portNumberPtr(8081), + }, }, }, }, @@ -106,15 +112,19 @@ func TestValidateHTTPRoute(t *testing.T) { { Type: gatewayv1a2.HTTPRouteFilterRequestMirror, RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ - ServiceName: &testService, - Port: portNumberPtr(8080), + BackendRef: &gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: portNumberPtr(8080), + }, }, }, { Type: gatewayv1a2.HTTPRouteFilterRequestMirror, RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ - ServiceName: &specialService, - Port: portNumberPtr(8080), + BackendRef: &gatewayv1a2.BackendObjectReference{ + Name: specialService, + Port: portNumberPtr(8080), + }, }, }, }, @@ -153,8 +163,10 @@ func TestValidateHTTPRoute(t *testing.T) { { Type: gatewayv1a2.HTTPRouteFilterRequestMirror, RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ - ServiceName: &testService, - Port: portNumberPtr(8080), + BackendRef: &gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: portNumberPtr(8080), + }, }, }, { @@ -193,8 +205,10 @@ func TestValidateHTTPRoute(t *testing.T) { { Type: gatewayv1a2.HTTPRouteFilterRequestMirror, RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ - ServiceName: &testService, - Port: portNumberPtr(8080), + BackendRef: &gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: portNumberPtr(8080), + }, }, }, { @@ -211,8 +225,10 @@ func TestValidateHTTPRoute(t *testing.T) { { Type: gatewayv1a2.HTTPRouteFilterRequestMirror, RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ - ServiceName: &testService, - Port: portNumberPtr(8080), + BackendRef: &gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: portNumberPtr(8080), + }, }, }, { @@ -229,8 +245,10 @@ func TestValidateHTTPRoute(t *testing.T) { { Type: gatewayv1a2.HTTPRouteFilterRequestMirror, RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ - ServiceName: &specialService, - Port: portNumberPtr(8080), + BackendRef: &gatewayv1a2.BackendObjectReference{ + Name: specialService, + Port: portNumberPtr(8080), + }, }, }, }, @@ -269,8 +287,10 @@ func TestValidateHTTPRoute(t *testing.T) { { Type: gatewayv1a2.HTTPRouteFilterRequestMirror, RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{ - ServiceName: &testService, - Port: portNumberPtr(8080), + BackendRef: &gatewayv1a2.BackendObjectReference{ + Name: testService, + Port: portNumberPtr(8080), + }, }, }, { diff --git a/apis/v1alpha2/zz_generated.deepcopy.go b/apis/v1alpha2/zz_generated.deepcopy.go index 82315772dd..e097759f38 100644 --- a/apis/v1alpha2/zz_generated.deepcopy.go +++ b/apis/v1alpha2/zz_generated.deepcopy.go @@ -25,6 +25,57 @@ import ( "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendObjectReference) DeepCopyInto(out *BackendObjectReference) { + *out = *in + if in.Group != nil { + in, out := &in.Group, &out.Group + *out = new(string) + **out = **in + } + if in.Kind != nil { + in, out := &in.Kind, &out.Kind + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(PortNumber) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendObjectReference. +func (in *BackendObjectReference) DeepCopy() *BackendObjectReference { + if in == nil { + return nil + } + out := new(BackendObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendRef) DeepCopyInto(out *BackendRef) { + *out = *in + in.BackendObjectReference.DeepCopyInto(&out.BackendObjectReference) + if in.Weight != nil { + in, out := &in.Weight, &out.Weight + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendRef. +func (in *BackendRef) DeepCopy() *BackendRef { + if in == nil { + return nil + } + out := new(BackendRef) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Gateway) DeepCopyInto(out *Gateway) { *out = *in @@ -327,6 +378,29 @@ func (in *GatewayTLSConfig) DeepCopy() *GatewayTLSConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPBackendRef) DeepCopyInto(out *HTTPBackendRef) { + *out = *in + in.BackendRef.DeepCopyInto(&out.BackendRef) + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = make([]HTTPRouteFilter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPBackendRef. +func (in *HTTPBackendRef) DeepCopy() *HTTPBackendRef { + if in == nil { + return nil + } + out := new(HTTPBackendRef) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HTTPHeader) DeepCopyInto(out *HTTPHeader) { *out = *in @@ -440,20 +514,10 @@ func (in *HTTPRequestHeaderFilter) DeepCopy() *HTTPRequestHeaderFilter { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HTTPRequestMirrorFilter) DeepCopyInto(out *HTTPRequestMirrorFilter) { *out = *in - if in.ServiceName != nil { - in, out := &in.ServiceName, &out.ServiceName - *out = new(string) - **out = **in - } if in.BackendRef != nil { in, out := &in.BackendRef, &out.BackendRef - *out = new(LocalObjectReference) - **out = **in - } - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(PortNumber) - **out = **in + *out = new(BackendObjectReference) + (*in).DeepCopyInto(*out) } } @@ -564,48 +628,6 @@ func (in *HTTPRouteFilter) DeepCopy() *HTTPRouteFilter { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRouteForwardTo) DeepCopyInto(out *HTTPRouteForwardTo) { - *out = *in - if in.ServiceName != nil { - in, out := &in.ServiceName, &out.ServiceName - *out = new(string) - **out = **in - } - if in.BackendRef != nil { - in, out := &in.BackendRef, &out.BackendRef - *out = new(LocalObjectReference) - **out = **in - } - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(PortNumber) - **out = **in - } - if in.Weight != nil { - in, out := &in.Weight, &out.Weight - *out = new(int32) - **out = **in - } - if in.Filters != nil { - in, out := &in.Filters, &out.Filters - *out = make([]HTTPRouteFilter, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteForwardTo. -func (in *HTTPRouteForwardTo) DeepCopy() *HTTPRouteForwardTo { - if in == nil { - return nil - } - out := new(HTTPRouteForwardTo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HTTPRouteList) DeepCopyInto(out *HTTPRouteList) { *out = *in @@ -699,9 +721,9 @@ func (in *HTTPRouteRule) DeepCopyInto(out *HTTPRouteRule) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.ForwardTo != nil { - in, out := &in.ForwardTo, &out.ForwardTo - *out = make([]HTTPRouteForwardTo, len(*in)) + if in.BackendRefs != nil { + in, out := &in.BackendRefs, &out.BackendRefs + *out = make([]HTTPBackendRef, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -894,41 +916,6 @@ func (in *RouteBindingSelector) DeepCopy() *RouteBindingSelector { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteForwardTo) DeepCopyInto(out *RouteForwardTo) { - *out = *in - if in.ServiceName != nil { - in, out := &in.ServiceName, &out.ServiceName - *out = new(string) - **out = **in - } - if in.BackendRef != nil { - in, out := &in.BackendRef, &out.BackendRef - *out = new(LocalObjectReference) - **out = **in - } - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(PortNumber) - **out = **in - } - if in.Weight != nil { - in, out := &in.Weight, &out.Weight - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteForwardTo. -func (in *RouteForwardTo) DeepCopy() *RouteForwardTo { - if in == nil { - return nil - } - out := new(RouteForwardTo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RouteGatewayStatus) DeepCopyInto(out *RouteGatewayStatus) { *out = *in @@ -1144,9 +1131,9 @@ func (in *TCPRouteRule) DeepCopyInto(out *TCPRouteRule) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.ForwardTo != nil { - in, out := &in.ForwardTo, &out.ForwardTo - *out = make([]RouteForwardTo, len(*in)) + if in.BackendRefs != nil { + in, out := &in.BackendRefs, &out.BackendRefs + *out = make([]BackendRef, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -1315,9 +1302,9 @@ func (in *TLSRouteRule) DeepCopyInto(out *TLSRouteRule) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.ForwardTo != nil { - in, out := &in.ForwardTo, &out.ForwardTo - *out = make([]RouteForwardTo, len(*in)) + if in.BackendRefs != nil { + in, out := &in.BackendRefs, &out.BackendRefs + *out = make([]BackendRef, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -1471,9 +1458,9 @@ func (in *UDPRouteRule) DeepCopyInto(out *UDPRouteRule) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.ForwardTo != nil { - in, out := &in.ForwardTo, &out.ForwardTo - *out = make([]RouteForwardTo, len(*in)) + if in.BackendRefs != nil { + in, out := &in.BackendRefs, &out.BackendRefs + *out = make([]BackendRef, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } diff --git a/config/crd/bases/gateway.networking.k8s.io_httproutes.yaml b/config/crd/bases/gateway.networking.k8s.io_httproutes.yaml index f4879c8e40..05a4882730 100644 --- a/config/crd/bases/gateway.networking.k8s.io_httproutes.yaml +++ b/config/crd/bases/gateway.networking.k8s.io_httproutes.yaml @@ -154,310 +154,18 @@ spec: request based on conditions, optionally executing additional processing steps, and forwarding the request to an API object. properties: - filters: - description: "Filters define the filters that are applied to - requests that match this rule. \n The effects of ordering - of multiple behaviors are currently unspecified. This can - change in the future based on feedback during the alpha stage. - \n Conformance-levels at this level are defined based on the - type of filter: \n - ALL core filters MUST be supported by - all implementations. - Implementers are encouraged to support - extended filters. - Implementation-specific custom filters - have no API guarantees across implementations. \n Specifying - a core filter multiple times has unspecified or custom conformance. - \n Support: Core" - items: - description: 'HTTPRouteFilter defines additional processing - steps that must be completed during the request or response - lifecycle. HTTPRouteFilters are meant as an extension point - to express additional processing that may be done in Gateway - implementations. Some examples include request or response - modification, implementing authentication strategies, rate-limiting, - and traffic shaping. API guarantee/conformance is defined - based on the type of the filter. TODO(hbagdi): re-render - CRDs once controller-tools supports union tags: - https://github.com/kubernetes-sigs/controller-tools/pull/298 - - https://github.com/kubernetes-sigs/controller-tools/issues/461' - properties: - extensionRef: - description: "ExtensionRef is an optional, implementation-specific - extension to the \"filter\" behavior. For example, - resource \"myroutefilter\" in group \"networking.acme.io\"). - ExtensionRef MUST NOT be used for core and extended - filters. \n Support: Implementation-specific" - properties: - group: - description: Group is the group of the referent. - maxLength: 253 - type: string - kind: - description: Kind is kind of the referent. - maxLength: 253 - minLength: 1 - type: string - name: - description: Name is the name of the referent. - maxLength: 253 - minLength: 1 - type: string - required: - - group - - kind - - name - type: object - requestHeaderModifier: - description: "RequestHeaderModifier defines a schema for - a filter that modifies request headers. \n Support: - Core" - properties: - add: - description: "Add adds the given header(s) (name, - value) to the request before the action. It appends - to any existing values associated with the header - name. \n Input: GET /foo HTTP/1.1 my-header: - foo \n Config: add: {\"my-header\": \"bar\"} \n - Output: GET /foo HTTP/1.1 my-header: foo my-header: - bar" - items: - description: HTTPHeader represents an HTTP Header - name and value as defined by RFC 7230. - properties: - name: - description: "Name is the name of the HTTP Header - to be matched. Name matching MUST be case - insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). - \n If multiple entries specify equivalent - header names, only the first entry with an - equivalent name MUST be considered for a match. - Subsequent entries with an equivalent header - name MUST be ignored. Due to the case-insensitivity - of header names, \"foo\" and \"Foo\" are considered - equivalent." - maxLength: 256 - minLength: 1 - type: string - value: - description: Value is the value of HTTP Header - to be matched. - maxLength: 4096 - minLength: 1 - type: string - required: - - name - - value - type: object - type: array - remove: - description: "Remove the given header(s) from the - HTTP request before the action. The value of RemoveHeader - is a list of HTTP header names. Note that the header - names are case-insensitive (see https://datatracker.ietf.org/doc/html/rfc2616#section-4.2). - \n Input: GET /foo HTTP/1.1 my-header1: foo - \ my-header2: bar my-header3: baz \n Config: - \ remove: [\"my-header1\", \"my-header3\"] \n Output: - \ GET /foo HTTP/1.1 my-header2: bar" - items: - type: string - maxItems: 16 - type: array - set: - description: "Set overwrites the request with the - given header (name, value) before the action. \n - Input: GET /foo HTTP/1.1 my-header: foo \n Config: - \ set: {\"my-header\": \"bar\"} \n Output: GET - /foo HTTP/1.1 my-header: bar" - items: - description: HTTPHeader represents an HTTP Header - name and value as defined by RFC 7230. - properties: - name: - description: "Name is the name of the HTTP Header - to be matched. Name matching MUST be case - insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). - \n If multiple entries specify equivalent - header names, only the first entry with an - equivalent name MUST be considered for a match. - Subsequent entries with an equivalent header - name MUST be ignored. Due to the case-insensitivity - of header names, \"foo\" and \"Foo\" are considered - equivalent." - maxLength: 256 - minLength: 1 - type: string - value: - description: Value is the value of HTTP Header - to be matched. - maxLength: 4096 - minLength: 1 - type: string - required: - - name - - value - type: object - type: array - type: object - requestMirror: - description: "RequestMirror defines a schema for a filter - that mirrors requests. \n Support: Extended" - properties: - backendRef: - description: "BackendRef is a local object reference - to mirror matched requests to. If both BackendRef - and ServiceName are specified, ServiceName will - be given precedence. \n If the referent cannot be - found, the rule is not included in the route. The - controller should raise the \"ResolvedRefs\" condition - on the Gateway with the \"DegradedRoutes\" reason. - The gateway status for this route should be updated - with a condition that describes the error more specifically. - \n Support: Custom" - properties: - group: - description: Group is the group of the referent. - maxLength: 253 - type: string - kind: - description: Kind is kind of the referent. - maxLength: 253 - minLength: 1 - type: string - name: - description: Name is the name of the referent. - maxLength: 253 - minLength: 1 - type: string - required: - - group - - kind - - name - type: object - port: - description: "Port specifies the destination port - number to use for the backend referenced by the - ServiceName or BackendRef field. \n If unspecified, - the destination port in the request is used when - forwarding to a backendRef or serviceName." - format: int32 - maximum: 65535 - minimum: 1 - type: integer - serviceName: - description: "ServiceName refers to the name of the - Service to mirror matched requests to. When specified, - this takes the place of BackendRef. If both BackendRef - and ServiceName are specified, ServiceName will - be given precedence. \n If the referent cannot be - found, the rule is not included in the route. The - controller should raise the \"ResolvedRefs\" condition - on the Gateway with the \"DegradedRoutes\" reason. - The gateway status for this route should be updated - with a condition that describes the error more specifically. - \n Support: Core" - maxLength: 253 - type: string - type: object - requestRedirect: - description: "RequestRedirect defines a schema for a filter - that redirects request. \n Support: Core" - properties: - hostname: - description: "Hostname is the hostname to be used - in the value of the `Location` header in the response. - When empty, the hostname of the request is used. - \n Support: Core" - type: string - port: - description: "Port is the port to be used in the value - of the `Location` header in the response. When empty, - port (if specified) of the request is used. \n Support: - Extended" - type: integer - protocol: - description: "Protocol is the protocol to be used - in the value of the `Location` header in the response. - When empty, the protocol of the request is used. - \n Support: Extended" - enum: - - HTTP - - HTTPS - type: string - statusCode: - default: 302 - description: "StatusCode is the HTTP status code to - be used in response. \n Support: Core" - type: integer - type: object - type: - description: "Type identifies the type of filter to apply. - As with other API fields, types are classified into - three conformance levels: \n - Core: Filter types and - their corresponding configuration defined by \"Support: - Core\" in this package, e.g. \"RequestHeaderModifier\". - All implementations must support core filters. \n - - Extended: Filter types and their corresponding configuration - defined by \"Support: Extended\" in this package, - e.g. \"RequestMirror\". Implementers are encouraged - to support extended filters. \n - Custom: Filters that - are defined and supported by specific vendors. In - the future, filters showing convergence in behavior - across multiple implementations will be considered - for inclusion in extended or core conformance levels. - Filter-specific configuration for such filters is - specified using the ExtensionRef field. `Type` should - be set to \"ExtensionRef\" for custom filters. \n - Implementers are encouraged to define custom implementation - types to extend the core API with implementation-specific - behavior." - enum: - - RequestHeaderModifier - - RequestMirror - - RequestRedirect - - ExtensionRef - type: string - required: - - type - type: object - maxItems: 16 - type: array - forwardTo: - description: ForwardTo defines the backend(s) where matching + backendRefs: + description: "BackendRefs defines the backend(s) where matching requests should be sent. If unspecified, the rule performs no forwarding. If unspecified and no filters are specified - that would result in a response being sent, a 503 error code - is returned. + that would result in a response being sent, a HTTP 503 status + code is returned. \n Support: Core for Kubernetes Service + Support: Custom for any other resource \n Support for weight: + Core" items: - description: HTTPRouteForwardTo defines how a HTTPRoute should - forward a request. + description: HTTPBackendRef defines how a HTTPRoute should + forward an HTTP request. properties: - backendRef: - description: "BackendRef is a reference to a backend to - forward matched requests to. If both BackendRef and - ServiceName are specified, ServiceName will be given - precedence. \n If the referent cannot be found, the - route must be dropped from the Gateway. The controller - should raise the \"ResolvedRefs\" condition on the Gateway - with the \"DegradedRoutes\" reason. The gateway status - for this route should be updated with a condition that - describes the error more specifically. \n Support: Custom" - properties: - group: - description: Group is the group of the referent. - maxLength: 253 - type: string - kind: - description: Kind is kind of the referent. - maxLength: 253 - minLength: 1 - type: string - name: - description: Name is the name of the referent. - maxLength: 253 - minLength: 1 - type: string - required: - - group - - kind - - name - type: object filters: description: "Filters defined at this-level should be executed if and only if the request is being forwarded @@ -608,23 +316,27 @@ spec: a filter that mirrors requests. \n Support: Extended" properties: backendRef: - description: "BackendRef is a local object reference - to mirror matched requests to. If both BackendRef - and ServiceName are specified, ServiceName - will be given precedence. \n If the referent - cannot be found, the rule is not included - in the route. The controller should raise - the \"ResolvedRefs\" condition on the Gateway - with the \"DegradedRoutes\" reason. The gateway - status for this route should be updated with - a condition that describes the error more - specifically. \n Support: Custom" + description: "BackendRef references a resource + where mirrored requests are sent. \n If the + referent cannot be found, the rule is not + included in the route. The controller should + raise the \"ResolvedRefs\" condition on the + Gateway with the \"DegradedRoutes\" reason. + The gateway status for this route should be + updated with a condition that describes the + error more specifically. \n Support: Extended + for Kubernetes Service Support: Custom for + any other resource" properties: group: + default: "" description: Group is the group of the referent. + When unspecified (empty string), core + API group is inferred. maxLength: 253 type: string kind: + default: Service description: Kind is kind of the referent. maxLength: 253 minLength: 1 @@ -634,37 +346,20 @@ spec: maxLength: 253 minLength: 1 type: string + port: + description: Port specifies the destination + port number to use for this resource. + Port is required when the referent is + a Kubernetes Service. For other resources, + destination port can be derived from the + referent resource or this field. + format: int32 + maximum: 65535 + minimum: 1 + type: integer required: - - group - - kind - name type: object - port: - description: "Port specifies the destination - port number to use for the backend referenced - by the ServiceName or BackendRef field. \n - If unspecified, the destination port in the - request is used when forwarding to a backendRef - or serviceName." - format: int32 - maximum: 65535 - minimum: 1 - type: integer - serviceName: - description: "ServiceName refers to the name - of the Service to mirror matched requests - to. When specified, this takes the place of - BackendRef. If both BackendRef and ServiceName - are specified, ServiceName will be given precedence. - \n If the referent cannot be found, the rule - is not included in the route. The controller - should raise the \"ResolvedRefs\" condition - on the Gateway with the \"DegradedRoutes\" - reason. The gateway status for this route - should be updated with a condition that describes - the error more specifically. \n Support: Core" - maxLength: 253 - type: string type: object requestRedirect: description: "RequestRedirect defines a schema for @@ -730,50 +425,305 @@ spec: type: object maxItems: 16 type: array + group: + default: "" + description: Group is the group of the referent. When + unspecified (empty string), core API group is inferred. + maxLength: 253 + type: string + kind: + default: Service + description: Kind is kind of the referent. + maxLength: 253 + minLength: 1 + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string port: - description: "Port specifies the destination port number - to use for the backend referenced by the ServiceName - or BackendRef field. If unspecified, the destination - port in the request is used when forwarding to a backendRef - or serviceName. \n Support: Core" + description: Port specifies the destination port number + to use for this resource. Port is required when the + referent is a Kubernetes Service. For other resources, + destination port can be derived from the referent resource + or this field. format: int32 maximum: 65535 minimum: 1 type: integer - serviceName: - description: "ServiceName refers to the name of the Service - to forward matched requests to. When specified, this - takes the place of BackendRef. If both BackendRef and - ServiceName are specified, ServiceName will be given - precedence. \n If the referent cannot be found, the - route must be dropped from the Gateway. The controller - should raise the \"ResolvedRefs\" condition on the Gateway - with the \"DegradedRoutes\" reason. The gateway status - for this route should be updated with a condition that - describes the error more specifically. \n The protocol - to use should be specified with the AppProtocol field - on Service resources. \n Support: Core" - maxLength: 253 - type: string weight: default: 1 description: "Weight specifies the proportion of HTTP - requests forwarded to the backend referenced by the - ServiceName or BackendRef field. This is computed as - weight/(sum of all weights in this ForwardTo list). - For non-zero values, there may be some epsilon from - the exact proportion defined here depending on the precision - an implementation supports. Weight is not a percentage - and the sum of weights does not need to equal 100. \n - If only one backend is specified and it has a weight - greater than 0, 100% of the traffic is forwarded to - that backend. If weight is set to 0, traffic must not - be forwarded for this entry. If unspecified, weight - defaults to 1. \n Support: Core" + requests forwarded to the referenced backend. This is + computed as weight/(sum of all weights in this ForwardTo + list). For non-zero values, there may be some epsilon + from the exact proportion defined here depending on + the precision an implementation supports. Weight is + not a percentage and the sum of weights does not need + to equal 100. \n If only one backend is specified and + it has a weight greater than 0, 100% of the traffic + is forwarded to that backend. If weight is set to 0, + no traffic should be forwarded for this entry. If unspecified, + weight defaults to 1. \n Support for this field varies + based on the context where used." format: int32 maximum: 1000000 minimum: 0 type: integer + required: + - name + type: object + maxItems: 16 + type: array + filters: + description: "Filters define the filters that are applied to + requests that match this rule. \n The effects of ordering + of multiple behaviors are currently unspecified. This can + change in the future based on feedback during the alpha stage. + \n Conformance-levels at this level are defined based on the + type of filter: \n - ALL core filters MUST be supported by + all implementations. - Implementers are encouraged to support + extended filters. - Implementation-specific custom filters + have no API guarantees across implementations. \n Specifying + a core filter multiple times has unspecified or custom conformance. + \n Support: Core" + items: + description: 'HTTPRouteFilter defines additional processing + steps that must be completed during the request or response + lifecycle. HTTPRouteFilters are meant as an extension point + to express additional processing that may be done in Gateway + implementations. Some examples include request or response + modification, implementing authentication strategies, rate-limiting, + and traffic shaping. API guarantee/conformance is defined + based on the type of the filter. TODO(hbagdi): re-render + CRDs once controller-tools supports union tags: - https://github.com/kubernetes-sigs/controller-tools/pull/298 + - https://github.com/kubernetes-sigs/controller-tools/issues/461' + properties: + extensionRef: + description: "ExtensionRef is an optional, implementation-specific + extension to the \"filter\" behavior. For example, + resource \"myroutefilter\" in group \"networking.acme.io\"). + ExtensionRef MUST NOT be used for core and extended + filters. \n Support: Implementation-specific" + properties: + group: + description: Group is the group of the referent. + maxLength: 253 + type: string + kind: + description: Kind is kind of the referent. + maxLength: 253 + minLength: 1 + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + required: + - group + - kind + - name + type: object + requestHeaderModifier: + description: "RequestHeaderModifier defines a schema for + a filter that modifies request headers. \n Support: + Core" + properties: + add: + description: "Add adds the given header(s) (name, + value) to the request before the action. It appends + to any existing values associated with the header + name. \n Input: GET /foo HTTP/1.1 my-header: + foo \n Config: add: {\"my-header\": \"bar\"} \n + Output: GET /foo HTTP/1.1 my-header: foo my-header: + bar" + items: + description: HTTPHeader represents an HTTP Header + name and value as defined by RFC 7230. + properties: + name: + description: "Name is the name of the HTTP Header + to be matched. Name matching MUST be case + insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). + \n If multiple entries specify equivalent + header names, only the first entry with an + equivalent name MUST be considered for a match. + Subsequent entries with an equivalent header + name MUST be ignored. Due to the case-insensitivity + of header names, \"foo\" and \"Foo\" are considered + equivalent." + maxLength: 256 + minLength: 1 + type: string + value: + description: Value is the value of HTTP Header + to be matched. + maxLength: 4096 + minLength: 1 + type: string + required: + - name + - value + type: object + type: array + remove: + description: "Remove the given header(s) from the + HTTP request before the action. The value of RemoveHeader + is a list of HTTP header names. Note that the header + names are case-insensitive (see https://datatracker.ietf.org/doc/html/rfc2616#section-4.2). + \n Input: GET /foo HTTP/1.1 my-header1: foo + \ my-header2: bar my-header3: baz \n Config: + \ remove: [\"my-header1\", \"my-header3\"] \n Output: + \ GET /foo HTTP/1.1 my-header2: bar" + items: + type: string + maxItems: 16 + type: array + set: + description: "Set overwrites the request with the + given header (name, value) before the action. \n + Input: GET /foo HTTP/1.1 my-header: foo \n Config: + \ set: {\"my-header\": \"bar\"} \n Output: GET + /foo HTTP/1.1 my-header: bar" + items: + description: HTTPHeader represents an HTTP Header + name and value as defined by RFC 7230. + properties: + name: + description: "Name is the name of the HTTP Header + to be matched. Name matching MUST be case + insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). + \n If multiple entries specify equivalent + header names, only the first entry with an + equivalent name MUST be considered for a match. + Subsequent entries with an equivalent header + name MUST be ignored. Due to the case-insensitivity + of header names, \"foo\" and \"Foo\" are considered + equivalent." + maxLength: 256 + minLength: 1 + type: string + value: + description: Value is the value of HTTP Header + to be matched. + maxLength: 4096 + minLength: 1 + type: string + required: + - name + - value + type: object + type: array + type: object + requestMirror: + description: "RequestMirror defines a schema for a filter + that mirrors requests. \n Support: Extended" + properties: + backendRef: + description: "BackendRef references a resource where + mirrored requests are sent. \n If the referent cannot + be found, the rule is not included in the route. + The controller should raise the \"ResolvedRefs\" + condition on the Gateway with the \"DegradedRoutes\" + reason. The gateway status for this route should + be updated with a condition that describes the error + more specifically. \n Support: Extended for Kubernetes + Service Support: Custom for any other resource" + properties: + group: + default: "" + description: Group is the group of the referent. + When unspecified (empty string), core API group + is inferred. + maxLength: 253 + type: string + kind: + default: Service + description: Kind is kind of the referent. + maxLength: 253 + minLength: 1 + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string + port: + description: Port specifies the destination port + number to use for this resource. Port is required + when the referent is a Kubernetes Service. For + other resources, destination port can be derived + from the referent resource or this field. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + required: + - name + type: object + type: object + requestRedirect: + description: "RequestRedirect defines a schema for a filter + that redirects request. \n Support: Core" + properties: + hostname: + description: "Hostname is the hostname to be used + in the value of the `Location` header in the response. + When empty, the hostname of the request is used. + \n Support: Core" + type: string + port: + description: "Port is the port to be used in the value + of the `Location` header in the response. When empty, + port (if specified) of the request is used. \n Support: + Extended" + type: integer + protocol: + description: "Protocol is the protocol to be used + in the value of the `Location` header in the response. + When empty, the protocol of the request is used. + \n Support: Extended" + enum: + - HTTP + - HTTPS + type: string + statusCode: + default: 302 + description: "StatusCode is the HTTP status code to + be used in response. \n Support: Core" + type: integer + type: object + type: + description: "Type identifies the type of filter to apply. + As with other API fields, types are classified into + three conformance levels: \n - Core: Filter types and + their corresponding configuration defined by \"Support: + Core\" in this package, e.g. \"RequestHeaderModifier\". + All implementations must support core filters. \n + - Extended: Filter types and their corresponding configuration + defined by \"Support: Extended\" in this package, + e.g. \"RequestMirror\". Implementers are encouraged + to support extended filters. \n - Custom: Filters that + are defined and supported by specific vendors. In + the future, filters showing convergence in behavior + across multiple implementations will be considered + for inclusion in extended or core conformance levels. + Filter-specific configuration for such filters is + specified using the ExtensionRef field. `Type` should + be set to \"ExtensionRef\" for custom filters. \n + Implementers are encouraged to define custom implementation + types to extend the core API with implementation-specific + behavior." + enum: + - RequestHeaderModifier + - RequestMirror + - RequestRedirect + - ExtensionRef + type: string + required: + - type type: object maxItems: 16 type: array diff --git a/config/crd/bases/gateway.networking.k8s.io_tcproutes.yaml b/config/crd/bases/gateway.networking.k8s.io_tcproutes.yaml index 9b7d7fccbd..97002843a1 100644 --- a/config/crd/bases/gateway.networking.k8s.io_tcproutes.yaml +++ b/config/crd/bases/gateway.networking.k8s.io_tcproutes.yaml @@ -89,87 +89,63 @@ spec: items: description: TCPRouteRule is the configuration for a given rule. properties: - forwardTo: - description: ForwardTo defines the backend(s) where matching - requests should be sent. + backendRefs: + description: "BackendRefs defines the backend(s) where matching + requests should be sent. \n Support: Core for Kubernetes Service + Support: Custom for any other resource \n Support for weight: + Extended" items: - description: RouteForwardTo defines how a Route should forward - a request. + description: BackendRef defines how a Route should forward + a request to a Kubernetes resource. properties: - backendRef: - description: "BackendRef is a reference to a backend to - forward matched requests to. If both BackendRef and - ServiceName are specified, ServiceName will be given - precedence. \n If the referent cannot be found, the - rule is not included in the route. The controller should - raise the \"ResolvedRefs\" condition on the Gateway - with the \"DegradedRoutes\" reason. The gateway status - for this route should be updated with a condition that - describes the error more specifically. \n Support: Custom" - properties: - group: - description: Group is the group of the referent. - maxLength: 253 - type: string - kind: - description: Kind is kind of the referent. - maxLength: 253 - minLength: 1 - type: string - name: - description: Name is the name of the referent. - maxLength: 253 - minLength: 1 - type: string - required: - - group - - kind - - name - type: object + group: + default: "" + description: Group is the group of the referent. When + unspecified (empty string), core API group is inferred. + maxLength: 253 + type: string + kind: + default: Service + description: Kind is kind of the referent. + maxLength: 253 + minLength: 1 + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string port: - description: "Port specifies the destination port number - to use for the backend referenced by the ServiceName - or BackendRef field. If unspecified, the destination - port in the request is used when forwarding to a backendRef - or serviceName. \n Support: Core" + description: Port specifies the destination port number + to use for this resource. Port is required when the + referent is a Kubernetes Service. For other resources, + destination port can be derived from the referent resource + or this field. format: int32 maximum: 65535 minimum: 1 type: integer - serviceName: - description: "ServiceName refers to the name of the Service - to forward matched requests to. When specified, this - takes the place of BackendRef. If both BackendRef and - ServiceName are specified, ServiceName will be given - precedence. \n If the referent cannot be found, the - rule is not included in the route. The controller should - raise the \"ResolvedRefs\" condition on the Gateway - with the \"DegradedRoutes\" reason. The gateway status - for this route should be updated with a condition that - describes the error more specifically. \n The protocol - to use should be specified with the AppProtocol field - on Service resources. \n Support: Core" - maxLength: 253 - type: string weight: default: 1 description: "Weight specifies the proportion of HTTP - requests forwarded to the backend referenced by the - ServiceName or BackendRef field. This is computed as - weight/(sum of all weights in this ForwardTo list). - For non-zero values, there may be some epsilon from - the exact proportion defined here depending on the precision - an implementation supports. Weight is not a percentage - and the sum of weights does not need to equal 100. \n - If only one backend is specified and it has a weight - greater than 0, 100% of the traffic is forwarded to - that backend. If weight is set to 0, no traffic should - be forwarded for this entry. If unspecified, weight - defaults to 1. \n Support: Extended" + requests forwarded to the referenced backend. This is + computed as weight/(sum of all weights in this ForwardTo + list). For non-zero values, there may be some epsilon + from the exact proportion defined here depending on + the precision an implementation supports. Weight is + not a percentage and the sum of weights does not need + to equal 100. \n If only one backend is specified and + it has a weight greater than 0, 100% of the traffic + is forwarded to that backend. If weight is set to 0, + no traffic should be forwarded for this entry. If unspecified, + weight defaults to 1. \n Support for this field varies + based on the context where used." format: int32 maximum: 1000000 minimum: 0 type: integer + required: + - name type: object maxItems: 16 minItems: 1 @@ -234,8 +210,6 @@ spec: type: object maxItems: 8 type: array - required: - - forwardTo type: object maxItems: 16 minItems: 1 diff --git a/config/crd/bases/gateway.networking.k8s.io_tlsroutes.yaml b/config/crd/bases/gateway.networking.k8s.io_tlsroutes.yaml index 85723127fa..0f90b2c914 100644 --- a/config/crd/bases/gateway.networking.k8s.io_tlsroutes.yaml +++ b/config/crd/bases/gateway.networking.k8s.io_tlsroutes.yaml @@ -129,87 +129,63 @@ spec: items: description: TLSRouteRule is the configuration for a given rule. properties: - forwardTo: - description: ForwardTo defines the backend(s) where matching - requests should be sent. + backendRefs: + description: "BackendRefs defines the backend(s) where matching + requests should be sent. \n Support: Core for Kubernetes Service + Support: Custom for any other resource \n Support for weight: + Extended" items: - description: RouteForwardTo defines how a Route should forward - a request. + description: BackendRef defines how a Route should forward + a request to a Kubernetes resource. properties: - backendRef: - description: "BackendRef is a reference to a backend to - forward matched requests to. If both BackendRef and - ServiceName are specified, ServiceName will be given - precedence. \n If the referent cannot be found, the - rule is not included in the route. The controller should - raise the \"ResolvedRefs\" condition on the Gateway - with the \"DegradedRoutes\" reason. The gateway status - for this route should be updated with a condition that - describes the error more specifically. \n Support: Custom" - properties: - group: - description: Group is the group of the referent. - maxLength: 253 - type: string - kind: - description: Kind is kind of the referent. - maxLength: 253 - minLength: 1 - type: string - name: - description: Name is the name of the referent. - maxLength: 253 - minLength: 1 - type: string - required: - - group - - kind - - name - type: object + group: + default: "" + description: Group is the group of the referent. When + unspecified (empty string), core API group is inferred. + maxLength: 253 + type: string + kind: + default: Service + description: Kind is kind of the referent. + maxLength: 253 + minLength: 1 + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string port: - description: "Port specifies the destination port number - to use for the backend referenced by the ServiceName - or BackendRef field. If unspecified, the destination - port in the request is used when forwarding to a backendRef - or serviceName. \n Support: Core" + description: Port specifies the destination port number + to use for this resource. Port is required when the + referent is a Kubernetes Service. For other resources, + destination port can be derived from the referent resource + or this field. format: int32 maximum: 65535 minimum: 1 type: integer - serviceName: - description: "ServiceName refers to the name of the Service - to forward matched requests to. When specified, this - takes the place of BackendRef. If both BackendRef and - ServiceName are specified, ServiceName will be given - precedence. \n If the referent cannot be found, the - rule is not included in the route. The controller should - raise the \"ResolvedRefs\" condition on the Gateway - with the \"DegradedRoutes\" reason. The gateway status - for this route should be updated with a condition that - describes the error more specifically. \n The protocol - to use should be specified with the AppProtocol field - on Service resources. \n Support: Core" - maxLength: 253 - type: string weight: default: 1 description: "Weight specifies the proportion of HTTP - requests forwarded to the backend referenced by the - ServiceName or BackendRef field. This is computed as - weight/(sum of all weights in this ForwardTo list). - For non-zero values, there may be some epsilon from - the exact proportion defined here depending on the precision - an implementation supports. Weight is not a percentage - and the sum of weights does not need to equal 100. \n - If only one backend is specified and it has a weight - greater than 0, 100% of the traffic is forwarded to - that backend. If weight is set to 0, no traffic should - be forwarded for this entry. If unspecified, weight - defaults to 1. \n Support: Extended" + requests forwarded to the referenced backend. This is + computed as weight/(sum of all weights in this ForwardTo + list). For non-zero values, there may be some epsilon + from the exact proportion defined here depending on + the precision an implementation supports. Weight is + not a percentage and the sum of weights does not need + to equal 100. \n If only one backend is specified and + it has a weight greater than 0, 100% of the traffic + is forwarded to that backend. If weight is set to 0, + no traffic should be forwarded for this entry. If unspecified, + weight defaults to 1. \n Support for this field varies + based on the context where used." format: int32 maximum: 1000000 minimum: 0 type: integer + required: + - name type: object maxItems: 16 minItems: 1 @@ -277,8 +253,6 @@ spec: type: object maxItems: 8 type: array - required: - - forwardTo type: object maxItems: 16 minItems: 1 diff --git a/config/crd/bases/gateway.networking.k8s.io_udproutes.yaml b/config/crd/bases/gateway.networking.k8s.io_udproutes.yaml index c6a18402af..9284ee6de5 100644 --- a/config/crd/bases/gateway.networking.k8s.io_udproutes.yaml +++ b/config/crd/bases/gateway.networking.k8s.io_udproutes.yaml @@ -90,87 +90,63 @@ spec: items: description: UDPRouteRule is the configuration for a given rule. properties: - forwardTo: - description: ForwardTo defines the backend(s) where matching - requests should be sent. + backendRefs: + description: "BackendRefs defines the backend(s) where matching + requests should be sent. \n Support: Core for Kubernetes Service + Support: Custom for any other resource \n Support for weight: + Extended" items: - description: RouteForwardTo defines how a Route should forward - a request. + description: BackendRef defines how a Route should forward + a request to a Kubernetes resource. properties: - backendRef: - description: "BackendRef is a reference to a backend to - forward matched requests to. If both BackendRef and - ServiceName are specified, ServiceName will be given - precedence. \n If the referent cannot be found, the - rule is not included in the route. The controller should - raise the \"ResolvedRefs\" condition on the Gateway - with the \"DegradedRoutes\" reason. The gateway status - for this route should be updated with a condition that - describes the error more specifically. \n Support: Custom" - properties: - group: - description: Group is the group of the referent. - maxLength: 253 - type: string - kind: - description: Kind is kind of the referent. - maxLength: 253 - minLength: 1 - type: string - name: - description: Name is the name of the referent. - maxLength: 253 - minLength: 1 - type: string - required: - - group - - kind - - name - type: object + group: + default: "" + description: Group is the group of the referent. When + unspecified (empty string), core API group is inferred. + maxLength: 253 + type: string + kind: + default: Service + description: Kind is kind of the referent. + maxLength: 253 + minLength: 1 + type: string + name: + description: Name is the name of the referent. + maxLength: 253 + minLength: 1 + type: string port: - description: "Port specifies the destination port number - to use for the backend referenced by the ServiceName - or BackendRef field. If unspecified, the destination - port in the request is used when forwarding to a backendRef - or serviceName. \n Support: Core" + description: Port specifies the destination port number + to use for this resource. Port is required when the + referent is a Kubernetes Service. For other resources, + destination port can be derived from the referent resource + or this field. format: int32 maximum: 65535 minimum: 1 type: integer - serviceName: - description: "ServiceName refers to the name of the Service - to forward matched requests to. When specified, this - takes the place of BackendRef. If both BackendRef and - ServiceName are specified, ServiceName will be given - precedence. \n If the referent cannot be found, the - rule is not included in the route. The controller should - raise the \"ResolvedRefs\" condition on the Gateway - with the \"DegradedRoutes\" reason. The gateway status - for this route should be updated with a condition that - describes the error more specifically. \n The protocol - to use should be specified with the AppProtocol field - on Service resources. \n Support: Core" - maxLength: 253 - type: string weight: default: 1 description: "Weight specifies the proportion of HTTP - requests forwarded to the backend referenced by the - ServiceName or BackendRef field. This is computed as - weight/(sum of all weights in this ForwardTo list). - For non-zero values, there may be some epsilon from - the exact proportion defined here depending on the precision - an implementation supports. Weight is not a percentage - and the sum of weights does not need to equal 100. \n - If only one backend is specified and it has a weight - greater than 0, 100% of the traffic is forwarded to - that backend. If weight is set to 0, no traffic should - be forwarded for this entry. If unspecified, weight - defaults to 1. \n Support: Extended" + requests forwarded to the referenced backend. This is + computed as weight/(sum of all weights in this ForwardTo + list). For non-zero values, there may be some epsilon + from the exact proportion defined here depending on + the precision an implementation supports. Weight is + not a percentage and the sum of weights does not need + to equal 100. \n If only one backend is specified and + it has a weight greater than 0, 100% of the traffic + is forwarded to that backend. If weight is set to 0, + no traffic should be forwarded for this entry. If unspecified, + weight defaults to 1. \n Support for this field varies + based on the context where used." format: int32 maximum: 1000000 minimum: 0 type: integer + required: + - name type: object maxItems: 16 minItems: 1 @@ -235,8 +211,6 @@ spec: type: object maxItems: 8 type: array - required: - - forwardTo type: object maxItems: 16 minItems: 1 diff --git a/examples/v1alpha2/basic-http.yaml b/examples/v1alpha2/basic-http.yaml index cfba1b588b..a3961e51ce 100644 --- a/examples/v1alpha2/basic-http.yaml +++ b/examples/v1alpha2/basic-http.yaml @@ -40,8 +40,8 @@ spec: - path: type: Prefix value: /bar - forwardTo: - - serviceName: my-service1 + backendRefs: + - name: my-service1 port: 8080 - matches: - headers: @@ -56,6 +56,6 @@ spec: type: Prefix value: /some/thing method: GET - forwardTo: - - serviceName: my-service2 + backendRefs: + - name: my-service2 port: 8080 diff --git a/examples/v1alpha2/default-match-http.yaml b/examples/v1alpha2/default-match-http.yaml index 58b752c1fb..d358fe71b5 100644 --- a/examples/v1alpha2/default-match-http.yaml +++ b/examples/v1alpha2/default-match-http.yaml @@ -41,16 +41,15 @@ spec: - type: Exact name: magic value: default-match - forwardTo: - - port: 8080 - backendRef: - name: my-custom-resource - group: acme.io - kind: CustomBackend + backendRefs: + - group: acme.io + kind: CustomBackend + name: my-custom-resource + port: 8080 - matches: - path: type: Exact value: /example/exact - forwardTo: - - serviceName: my-service-2 + backendRefs: + - name: my-service-2 port: 8080 diff --git a/examples/v1alpha2/http-redirect.yaml b/examples/v1alpha2/http-redirect.yaml index 67d4da1813..8077f89eb4 100644 --- a/examples/v1alpha2/http-redirect.yaml +++ b/examples/v1alpha2/http-redirect.yaml @@ -75,7 +75,7 @@ spec: - path: type: Prefix value: / - forwardTo: - - serviceName: my-filter-svc1 + backendRefs: + - name: my-filter-svc1 weight: 1 port: 80 diff --git a/examples/v1alpha2/traffic-split-1.yaml b/examples/v1alpha2/traffic-split-1.yaml index 540a4289e4..e8d32cb638 100644 --- a/examples/v1alpha2/traffic-split-1.yaml +++ b/examples/v1alpha2/traffic-split-1.yaml @@ -8,14 +8,14 @@ spec: hostnames: - foo.example.com rules: - - forwardTo: - - serviceName: foo-v1 + - backendRefs: + - name: foo-v1 port: 8080 - matches: - headers: - type: Exact name: traffic value: test - forwardTo: - - serviceName: foo-v2 + backendRefs: + - name: foo-v2 port: 8080 diff --git a/site-src/geps/gep-718.md b/site-src/geps/gep-718.md index 091d01c03e..28151e344f 100644 --- a/site-src/geps/gep-718.md +++ b/site-src/geps/gep-718.md @@ -2,7 +2,7 @@ Issue: [#718](https://github.com/kubernetes-sigs/gateway-api/issues/718) -Status: Implementable +Status: Implemented ## Motivation