diff --git a/apis/v1/grpcroute_types.go b/apis/v1/grpcroute_types.go index 291a7e0510..8c4e8ad05e 100644 --- a/apis/v1/grpcroute_types.go +++ b/apis/v1/grpcroute_types.go @@ -154,7 +154,8 @@ type GRPCRouteRule struct { // Name is the name of the route rule. This name MUST be unique within a Route if it is set. // // Support: Extended - Name SectionName `json:"name,omitempty"` + // +optional + Name *SectionName `json:"name,omitempty"` // Matches define conditions used for matching the rule against incoming // gRPC requests. Each match is independent, i.e. this rule will be matched diff --git a/apis/v1/httproute_types.go b/apis/v1/httproute_types.go index 5be6792cff..b816e1a460 100644 --- a/apis/v1/httproute_types.go +++ b/apis/v1/httproute_types.go @@ -136,7 +136,8 @@ type HTTPRouteRule struct { // Name is the name of the route rule. This name MUST be unique within a Route if it is set. // // Support: Extended - Name SectionName `json:"name,omitempty"` + // +optional + Name *SectionName `json:"name,omitempty"` // Matches define conditions used for matching the rule against incoming // HTTP requests. Each match is independent, i.e. this rule will be matched diff --git a/apis/v1/zz_generated.deepcopy.go b/apis/v1/zz_generated.deepcopy.go index 3cde481a77..e2da9fcabb 100644 --- a/apis/v1/zz_generated.deepcopy.go +++ b/apis/v1/zz_generated.deepcopy.go @@ -349,6 +349,11 @@ func (in *GRPCRouteMatch) DeepCopy() *GRPCRouteMatch { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GRPCRouteRule) DeepCopyInto(out *GRPCRouteRule) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(SectionName) + **out = **in + } if in.Matches != nil { in, out := &in.Matches, &out.Matches *out = make([]GRPCRouteMatch, len(*in)) @@ -1139,6 +1144,11 @@ func (in *HTTPRouteMatch) DeepCopy() *HTTPRouteMatch { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HTTPRouteRule) DeepCopyInto(out *HTTPRouteRule) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(SectionName) + **out = **in + } if in.Matches != nil { in, out := &in.Matches, &out.Matches *out = make([]HTTPRouteMatch, len(*in)) diff --git a/apis/v1alpha2/tcproute_types.go b/apis/v1alpha2/tcproute_types.go index ee5e7e7c4e..3178558623 100644 --- a/apis/v1alpha2/tcproute_types.go +++ b/apis/v1alpha2/tcproute_types.go @@ -63,7 +63,8 @@ type TCPRouteRule struct { // Name is the name of the route rule. This name MUST be unique within a Route if it is set. // // Support: Extended - Name SectionName `json:"name,omitempty"` + // +optional + Name *SectionName `json:"name,omitempty"` // BackendRefs defines the backend(s) where matching requests should be // sent. If unspecified or invalid (refers to a non-existent resource or a diff --git a/apis/v1alpha2/tlsroute_types.go b/apis/v1alpha2/tlsroute_types.go index 4fdc5d1072..d6d2b25e73 100644 --- a/apis/v1alpha2/tlsroute_types.go +++ b/apis/v1alpha2/tlsroute_types.go @@ -104,7 +104,8 @@ type TLSRouteRule struct { // Name is the name of the route rule. This name MUST be unique within a Route if it is set. // // Support: Extended - Name SectionName `json:"name,omitempty"` + // +optional + Name *SectionName `json:"name,omitempty"` // BackendRefs defines the backend(s) where matching requests should be // sent. If unspecified or invalid (refers to a non-existent resource or diff --git a/apis/v1alpha2/udproute_types.go b/apis/v1alpha2/udproute_types.go index 5373c683ba..05ac7a20ac 100644 --- a/apis/v1alpha2/udproute_types.go +++ b/apis/v1alpha2/udproute_types.go @@ -63,7 +63,8 @@ type UDPRouteRule struct { // Name is the name of the route rule. This name MUST be unique within a Route if it is set. // // Support: Extended - Name SectionName `json:"name,omitempty"` + // +optional + Name *SectionName `json:"name,omitempty"` // BackendRefs defines the backend(s) where matching requests should be // sent. If unspecified or invalid (refers to a non-existent resource or a diff --git a/apis/v1alpha2/zz_generated.deepcopy.go b/apis/v1alpha2/zz_generated.deepcopy.go index 20b3cdb942..df8c0f3736 100644 --- a/apis/v1alpha2/zz_generated.deepcopy.go +++ b/apis/v1alpha2/zz_generated.deepcopy.go @@ -407,6 +407,11 @@ func (in *TCPRouteList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TCPRouteRule) DeepCopyInto(out *TCPRouteRule) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(v1.SectionName) + **out = **in + } if in.BackendRefs != nil { in, out := &in.BackendRefs, &out.BackendRefs *out = make([]v1.BackendRef, len(*in)) @@ -527,6 +532,11 @@ func (in *TLSRouteList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TLSRouteRule) DeepCopyInto(out *TLSRouteRule) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(v1.SectionName) + **out = **in + } if in.BackendRefs != nil { in, out := &in.BackendRefs, &out.BackendRefs *out = make([]v1.BackendRef, len(*in)) @@ -652,6 +662,11 @@ func (in *UDPRouteList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *UDPRouteRule) DeepCopyInto(out *UDPRouteRule) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(v1.SectionName) + **out = **in + } if in.BackendRefs != nil { in, out := &in.BackendRefs, &out.BackendRefs *out = make([]v1.BackendRef, len(*in)) diff --git a/pkg/test/cel/httproute_test.go b/pkg/test/cel/httproute_test.go index 557f63af25..c8e82d735c 100644 --- a/pkg/test/cel/httproute_test.go +++ b/pkg/test/cel/httproute_test.go @@ -1214,10 +1214,10 @@ func TestHTTPRouteRule(t *testing.T) { wantErrors: []string{"Route name must be unique within the route"}, rules: []gatewayv1.HTTPRouteRule{ { - Name: "name1", + Name: ptrTo(gatewayv1.SectionName("name1")), }, { - Name: "name1", + Name: ptrTo(gatewayv1.SectionName("name1")), }, }, },