diff --git a/apis/v1alpha1/httproute_types.go b/apis/v1alpha1/httproute_types.go index 2168d2bcf1..7a95e4a8f5 100644 --- a/apis/v1alpha1/httproute_types.go +++ b/apis/v1alpha1/httproute_types.go @@ -277,9 +277,13 @@ const ( // FilterTypeHTTPRequestHeader can be used to add or remove an HTTP // header from an HTTP request before it is sent to the upstream target. // Support: core - // +optional FilterTypeHTTPRequestHeader = "RequestHeader" - // TODO(hbagdi): add FilterHTTPRequestMirroring filter + + // FilterTypeHTTPRequestMirror can be used to mirror requests to a + // different backend. The responses from this backend MUST be ignored + // by the Gateway. + // Support: extended + FilterTypeHTTPRequestMirror = "RequestMirror" // FilterTypeImplementationSpecific should be used for configuring // custom filters. @@ -334,6 +338,8 @@ type HTTPRouteFilter struct { // Filter-specific configuration definitions for core and extended filters RequestHeader *HTTPRequestHeaderFilter `json:"requestHeader"` + + RequestMirror *HTTPRequestMirrorFilter `json:"requestMirror"` } // HTTPRequestHeaderFilter defines configuration for the @@ -379,6 +385,35 @@ type HTTPRequestHeaderFilter struct { // TODO } +// HTTPRequestMirrorFilter defines configuration for the +// RequestMirror filter. +type HTTPRequestMirrorFilter struct { + // TargetRef is an object reference to forward matched requests to. + // The resource may be "services" (omit or use the empty string for the + // group), or an implementation may support other resources (for + // example, resource "myroutetargets" in group "networking.acme.io"). + // Omitting or specifying the empty string for both the resource and + // group indicates that the resource is "services". If the referent + // cannot be found, the "InvalidRoutes" status condition on any Gateway + // that includes the HTTPRoute will be true. + // + // Support: Core (Kubernetes Services) + // Support: Implementation-specific (Other resource types) + // + TargetRef ForwardToTargetObjectReference `json:"targetRef" protobuf:"bytes,1,opt,name=targetRef"` + + // TargetPort specifies the destination port number to use for the TargetRef. + // If unspecified and TargetRef is a Service object consisting of a single + // port definition, that port will be used. If unspecified and TargetRef is + // a Service object consisting of multiple port definitions, an error is + // surfaced in status. + // + // Support: Core + // + // +optional + TargetPort *TargetPort `json:"targetPort,omitempty" protobuf:"bytes,2,opt,name=targetPort"` +} + // HTTPRouteAction is the action taken given a match. type HTTPRouteAction struct { // ForwardTo sends requests to the referenced object(s). The diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index 533962dbb8..54cad67581 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -415,6 +415,27 @@ func (in *HTTPRequestHeaderFilter) DeepCopy() *HTTPRequestHeaderFilter { return out } +// 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 + out.TargetRef = in.TargetRef + if in.TargetPort != nil { + in, out := &in.TargetPort, &out.TargetPort + *out = new(TargetPort) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRequestMirrorFilter. +func (in *HTTPRequestMirrorFilter) DeepCopy() *HTTPRequestMirrorFilter { + if in == nil { + return nil + } + out := new(HTTPRequestMirrorFilter) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HTTPRoute) DeepCopyInto(out *HTTPRoute) { *out = *in @@ -482,6 +503,11 @@ func (in *HTTPRouteFilter) DeepCopyInto(out *HTTPRouteFilter) { *out = new(HTTPRequestHeaderFilter) (*in).DeepCopyInto(*out) } + if in.RequestMirror != nil { + in, out := &in.RequestMirror, &out.RequestMirror + *out = new(HTTPRequestMirrorFilter) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteFilter. diff --git a/config/crd/bases/networking.x-k8s.io_httproutes.yaml b/config/crd/bases/networking.x-k8s.io_httproutes.yaml index cf414854fa..4ed7aaca22 100644 --- a/config/crd/bases/networking.x-k8s.io_httproutes.yaml +++ b/config/crd/bases/networking.x-k8s.io_httproutes.yaml @@ -128,11 +128,39 @@ spec: - add - remove type: object + requestMirror: + description: HTTPRequestMirrorFilter defines configuration for the RequestMirror filter. + properties: + targetPort: + description: "TargetPort specifies the destination port number to use for the TargetRef. If unspecified and TargetRef is a Service object consisting of a single port definition, that port will be used. If unspecified and TargetRef is a Service object consisting of multiple port definitions, an error is surfaced in status. \n Support: Core" + format: int32 + type: integer + targetRef: + description: "TargetRef is an object reference to forward matched requests to. The resource may be \"services\" (omit or use the empty string for the group), or an implementation may support other resources (for example, resource \"myroutetargets\" in group \"networking.acme.io\"). Omitting or specifying the empty string for both the resource and group indicates that the resource is \"services\". If the referent cannot be found, the \"InvalidRoutes\" status condition on any Gateway that includes the HTTPRoute will be true. \n Support: Core (Kubernetes Services) Support: Implementation-specific (Other resource types)" + properties: + group: + default: core + description: "Group is the group of the referent. Omitting the value or specifying the empty string indicates the core API group. For example, use the following to specify a service: \n fooRef: resource: services name: myservice \n Otherwise, if the core API group is not desired, specify the desired group: \n fooRef: group: acme.io resource: foos name: myfoo" + type: string + name: + description: Name is the name of the referent. + type: string + resource: + default: services + description: "Resource is the API resource name of the referent. Omitting the value or specifying the empty string indicates the services resource. For example, use the following to specify a services resource: \n fooRef: name: myservice \n Otherwise, if the services resource is not desired, specify the desired group: \n fooRef: group: acme.io resource: foos name: myfoo" + type: string + required: + - name + type: object + required: + - targetRef + type: object type: description: "Type identifies the filter to execute. Types are classified into three conformance-levels (similar to other locations in this API): - Core and extended: These filter types and their corresponding configuration is defined in this package. All implementations must implement the core filters. Implementers are encouraged to support extended filters. Definitions for filter-specific configuration for these filters is defined in this package. - Custom: These filters 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 rings. Filter-specific configuration for such filters is specified using the ExtensionRef field. `Type` should be set to \"ImplementationSpecific\" for custom filters. \n Implementers are encouraged to define custom implementation types to extend the core API with implementation-specific behavior." type: string required: - requestHeader + - requestMirror - type type: object type: array @@ -209,11 +237,39 @@ spec: - add - remove type: object + requestMirror: + description: HTTPRequestMirrorFilter defines configuration for the RequestMirror filter. + properties: + targetPort: + description: "TargetPort specifies the destination port number to use for the TargetRef. If unspecified and TargetRef is a Service object consisting of a single port definition, that port will be used. If unspecified and TargetRef is a Service object consisting of multiple port definitions, an error is surfaced in status. \n Support: Core" + format: int32 + type: integer + targetRef: + description: "TargetRef is an object reference to forward matched requests to. The resource may be \"services\" (omit or use the empty string for the group), or an implementation may support other resources (for example, resource \"myroutetargets\" in group \"networking.acme.io\"). Omitting or specifying the empty string for both the resource and group indicates that the resource is \"services\". If the referent cannot be found, the \"InvalidRoutes\" status condition on any Gateway that includes the HTTPRoute will be true. \n Support: Core (Kubernetes Services) Support: Implementation-specific (Other resource types)" + properties: + group: + default: core + description: "Group is the group of the referent. Omitting the value or specifying the empty string indicates the core API group. For example, use the following to specify a service: \n fooRef: resource: services name: myservice \n Otherwise, if the core API group is not desired, specify the desired group: \n fooRef: group: acme.io resource: foos name: myfoo" + type: string + name: + description: Name is the name of the referent. + type: string + resource: + default: services + description: "Resource is the API resource name of the referent. Omitting the value or specifying the empty string indicates the services resource. For example, use the following to specify a services resource: \n fooRef: name: myservice \n Otherwise, if the services resource is not desired, specify the desired group: \n fooRef: group: acme.io resource: foos name: myfoo" + type: string + required: + - name + type: object + required: + - targetRef + type: object type: description: "Type identifies the filter to execute. Types are classified into three conformance-levels (similar to other locations in this API): - Core and extended: These filter types and their corresponding configuration is defined in this package. All implementations must implement the core filters. Implementers are encouraged to support extended filters. Definitions for filter-specific configuration for these filters is defined in this package. - Custom: These filters 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 rings. Filter-specific configuration for such filters is specified using the ExtensionRef field. `Type` should be set to \"ImplementationSpecific\" for custom filters. \n Implementers are encouraged to define custom implementation types to extend the core API with implementation-specific behavior." type: string required: - requestHeader + - requestMirror - type type: object type: array diff --git a/config/crd/bases/networking.x-k8s.io_tcproutes.yaml b/config/crd/bases/networking.x-k8s.io_tcproutes.yaml index 0b7baa3e4a..422712d38b 100644 --- a/config/crd/bases/networking.x-k8s.io_tcproutes.yaml +++ b/config/crd/bases/networking.x-k8s.io_tcproutes.yaml @@ -101,11 +101,39 @@ spec: - add - remove type: object + requestMirror: + description: HTTPRequestMirrorFilter defines configuration for the RequestMirror filter. + properties: + targetPort: + description: "TargetPort specifies the destination port number to use for the TargetRef. If unspecified and TargetRef is a Service object consisting of a single port definition, that port will be used. If unspecified and TargetRef is a Service object consisting of multiple port definitions, an error is surfaced in status. \n Support: Core" + format: int32 + type: integer + targetRef: + description: "TargetRef is an object reference to forward matched requests to. The resource may be \"services\" (omit or use the empty string for the group), or an implementation may support other resources (for example, resource \"myroutetargets\" in group \"networking.acme.io\"). Omitting or specifying the empty string for both the resource and group indicates that the resource is \"services\". If the referent cannot be found, the \"InvalidRoutes\" status condition on any Gateway that includes the HTTPRoute will be true. \n Support: Core (Kubernetes Services) Support: Implementation-specific (Other resource types)" + properties: + group: + default: core + description: "Group is the group of the referent. Omitting the value or specifying the empty string indicates the core API group. For example, use the following to specify a service: \n fooRef: resource: services name: myservice \n Otherwise, if the core API group is not desired, specify the desired group: \n fooRef: group: acme.io resource: foos name: myfoo" + type: string + name: + description: Name is the name of the referent. + type: string + resource: + default: services + description: "Resource is the API resource name of the referent. Omitting the value or specifying the empty string indicates the services resource. For example, use the following to specify a services resource: \n fooRef: name: myservice \n Otherwise, if the services resource is not desired, specify the desired group: \n fooRef: group: acme.io resource: foos name: myfoo" + type: string + required: + - name + type: object + required: + - targetRef + type: object type: description: "Type identifies the filter to execute. Types are classified into three conformance-levels (similar to other locations in this API): - Core and extended: These filter types and their corresponding configuration is defined in this package. All implementations must implement the core filters. Implementers are encouraged to support extended filters. Definitions for filter-specific configuration for these filters is defined in this package. - Custom: These filters 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 rings. Filter-specific configuration for such filters is specified using the ExtensionRef field. `Type` should be set to \"ImplementationSpecific\" for custom filters. \n Implementers are encouraged to define custom implementation types to extend the core API with implementation-specific behavior." type: string required: - requestHeader + - requestMirror - type type: object type: array diff --git a/config/crd/bases/networking.x-k8s.io_udproutes.yaml b/config/crd/bases/networking.x-k8s.io_udproutes.yaml index 6bb6aa9b94..cbeced78d7 100644 --- a/config/crd/bases/networking.x-k8s.io_udproutes.yaml +++ b/config/crd/bases/networking.x-k8s.io_udproutes.yaml @@ -99,11 +99,39 @@ spec: - add - remove type: object + requestMirror: + description: HTTPRequestMirrorFilter defines configuration for the RequestMirror filter. + properties: + targetPort: + description: "TargetPort specifies the destination port number to use for the TargetRef. If unspecified and TargetRef is a Service object consisting of a single port definition, that port will be used. If unspecified and TargetRef is a Service object consisting of multiple port definitions, an error is surfaced in status. \n Support: Core" + format: int32 + type: integer + targetRef: + description: "TargetRef is an object reference to forward matched requests to. The resource may be \"services\" (omit or use the empty string for the group), or an implementation may support other resources (for example, resource \"myroutetargets\" in group \"networking.acme.io\"). Omitting or specifying the empty string for both the resource and group indicates that the resource is \"services\". If the referent cannot be found, the \"InvalidRoutes\" status condition on any Gateway that includes the HTTPRoute will be true. \n Support: Core (Kubernetes Services) Support: Implementation-specific (Other resource types)" + properties: + group: + default: core + description: "Group is the group of the referent. Omitting the value or specifying the empty string indicates the core API group. For example, use the following to specify a service: \n fooRef: resource: services name: myservice \n Otherwise, if the core API group is not desired, specify the desired group: \n fooRef: group: acme.io resource: foos name: myfoo" + type: string + name: + description: Name is the name of the referent. + type: string + resource: + default: services + description: "Resource is the API resource name of the referent. Omitting the value or specifying the empty string indicates the services resource. For example, use the following to specify a services resource: \n fooRef: name: myservice \n Otherwise, if the services resource is not desired, specify the desired group: \n fooRef: group: acme.io resource: foos name: myfoo" + type: string + required: + - name + type: object + required: + - targetRef + type: object type: description: "Type identifies the filter to execute. Types are classified into three conformance-levels (similar to other locations in this API): - Core and extended: These filter types and their corresponding configuration is defined in this package. All implementations must implement the core filters. Implementers are encouraged to support extended filters. Definitions for filter-specific configuration for these filters is defined in this package. - Custom: These filters 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 rings. Filter-specific configuration for such filters is specified using the ExtensionRef field. `Type` should be set to \"ImplementationSpecific\" for custom filters. \n Implementers are encouraged to define custom implementation types to extend the core API with implementation-specific behavior." type: string required: - requestHeader + - requestMirror - type type: object type: array diff --git a/docs-src/spec.md b/docs-src/spec.md index 59062663dc..52605273a7 100644 --- a/docs-src/spec.md +++ b/docs-src/spec.md @@ -1590,6 +1590,67 @@ My-Header2: DEF
++(Appears on: +HTTPRouteFilter) +
++
HTTPRequestMirrorFilter defines configuration for the +RequestMirror filter.
+ +Field | +Description | +
---|---|
+targetRef
+
+
+ServicesDefaultLocalObjectReference
+
+
+ |
+
+ TargetRef is an object reference to forward matched requests to. +The resource may be “services” (omit or use the empty string for the +group), or an implementation may support other resources (for +example, resource “myroutetargets” in group “networking.acme.io”). +Omitting or specifying the empty string for both the resource and +group indicates that the resource is “services”. If the referent +cannot be found, the “InvalidRoutes” status condition on any Gateway +that includes the HTTPRoute will be true. +Support: Core (Kubernetes Services) +Support: Implementation-specific (Other resource types) + |
+
+targetPort
+
+
+TargetPort
+
+
+ |
+
+(Optional)
+ TargetPort specifies the destination port number to use for the TargetRef. +If unspecified and TargetRef is a Service object consisting of a single +port definition, that port will be used. If unspecified and TargetRef is +a Service object consisting of multiple port definitions, an error is +surfaced in status. +Support: Core + |
+
@@ -1737,6 +1798,18 @@ HTTPRequestHeaderFilter
requestMirror
+
+
+HTTPRequestMirrorFilter
+
+
+(Appears on: -ForwardToTarget) +ForwardToTarget, +HTTPRequestMirrorFilter)
ServicesDefaultLocalObjectReference identifies an API object within a @@ -3262,7 +3336,8 @@ construct.
(int32
alias)
(Appears on: -ForwardToTarget) +ForwardToTarget, +HTTPRequestMirrorFilter)
TargetPort specifies the destination port number to use for a TargetRef.
diff --git a/docs/spec/index.html b/docs/spec/index.html index f73df6edce..8a683ccb16 100644 --- a/docs/spec/index.html +++ b/docs/spec/index.html @@ -1915,6 +1915,67 @@+(Appears on: +HTTPRouteFilter) +
++
HTTPRequestMirrorFilter defines configuration for the +RequestMirror filter.
+ +Field | +Description | +
---|---|
+targetRef
+
+
+ServicesDefaultLocalObjectReference
+
+
+ |
+
+ TargetRef is an object reference to forward matched requests to. +The resource may be “services” (omit or use the empty string for the +group), or an implementation may support other resources (for +example, resource “myroutetargets” in group “networking.acme.io”). +Omitting or specifying the empty string for both the resource and +group indicates that the resource is “services”. If the referent +cannot be found, the “InvalidRoutes” status condition on any Gateway +that includes the HTTPRoute will be true. +Support: Core (Kubernetes Services) +Support: Implementation-specific (Other resource types) + |
+
+targetPort
+
+
+TargetPort
+
+
+ |
+
+(Optional)
+ TargetPort specifies the destination port number to use for the TargetRef. +If unspecified and TargetRef is a Service object consisting of a single +port definition, that port will be used. If unspecified and TargetRef is +a Service object consisting of multiple port definitions, an error is +surfaced in status. +Support: Core + |
+
@@ -2062,6 +2123,18 @@
requestMirror
+
+
+HTTPRequestMirrorFilter
+
+
+(Appears on: -ForwardToTarget) +ForwardToTarget, +HTTPRequestMirrorFilter)
ServicesDefaultLocalObjectReference identifies an API object within a @@ -3587,7 +3661,8 @@
int32
alias)(Appears on: -ForwardToTarget) +ForwardToTarget, +HTTPRequestMirrorFilter)
TargetPort specifies the destination port number to use for a TargetRef.