From 791ea1789b69d74d647a9025e72b250f60ed9bcb Mon Sep 17 00:00:00 2001 From: John Howard Date: Fri, 27 Aug 2021 14:04:58 -0700 Subject: [PATCH] Make MirrorFilter.BackendRef required Currently this is optional. I cannot see any reason why it would not be required, as the whole point of mirroring is the request goes to some backend? --- apis/v1alpha2/httproute_types.go | 4 +--- apis/v1alpha2/zz_generated.deepcopy.go | 6 +----- .../crd/v1alpha2/gateway.networking.k8s.io_httproutes.yaml | 4 ++++ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/apis/v1alpha2/httproute_types.go b/apis/v1alpha2/httproute_types.go index 518b926430..7c3a4cc9fa 100644 --- a/apis/v1alpha2/httproute_types.go +++ b/apis/v1alpha2/httproute_types.go @@ -722,9 +722,7 @@ type HTTPRequestMirrorFilter struct { // // Support: Extended for Kubernetes Service // Support: Custom for any other resource - // - // +optional - BackendRef *BackendObjectReference `json:"backendRef,omitempty"` + BackendRef BackendObjectReference `json:"backendRef"` } // HTTPBackendRef defines how a HTTPRoute should forward an HTTP request. diff --git a/apis/v1alpha2/zz_generated.deepcopy.go b/apis/v1alpha2/zz_generated.deepcopy.go index d0c786d5cf..383c680db2 100644 --- a/apis/v1alpha2/zz_generated.deepcopy.go +++ b/apis/v1alpha2/zz_generated.deepcopy.go @@ -549,11 +549,7 @@ 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.BackendRef != nil { - in, out := &in.BackendRef, &out.BackendRef - *out = new(BackendObjectReference) - (*in).DeepCopyInto(*out) - } + in.BackendRef.DeepCopyInto(&out.BackendRef) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRequestMirrorFilter. diff --git a/config/crd/v1alpha2/gateway.networking.k8s.io_httproutes.yaml b/config/crd/v1alpha2/gateway.networking.k8s.io_httproutes.yaml index af01b2aca7..9ddb0d584d 100644 --- a/config/crd/v1alpha2/gateway.networking.k8s.io_httproutes.yaml +++ b/config/crd/v1alpha2/gateway.networking.k8s.io_httproutes.yaml @@ -440,6 +440,8 @@ spec: required: - name type: object + required: + - backendRef type: object requestRedirect: description: "RequestRedirect defines a schema for @@ -807,6 +809,8 @@ spec: required: - name type: object + required: + - backendRef type: object requestRedirect: description: "RequestRedirect defines a schema for a filter