Skip to content

Commit

Permalink
Make group as optional in LocalObjectReference
Browse files Browse the repository at this point in the history
Fixes #3322

Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Sep 12, 2024
1 parent 5299919 commit d07c276
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 36 deletions.
2 changes: 2 additions & 0 deletions apis/v1/object_reference_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ package v1
type LocalObjectReference struct {
// Group is the group of the referent. For example, "gateway.networking.k8s.io".
// When unspecified or empty string, core API group is inferred.
//
// +optional
Group Group `json:"group"`

// Kind is kind of the referent. For example "HTTPRoute" or "Service".
Expand Down

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

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

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

4 changes: 0 additions & 4 deletions config/crd/standard/gateway.networking.k8s.io_grpcroutes.yaml

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

4 changes: 0 additions & 4 deletions config/crd/standard/gateway.networking.k8s.io_httproutes.yaml

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

2 changes: 1 addition & 1 deletion pkg/generated/openapi/zz_generated.openapi.go

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

18 changes: 9 additions & 9 deletions pkg/test/cel/grpcroute_experimental_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestGRPCRequestMirrorFilterExperimental(t *testing.T) {
rules []gatewayv1.GRPCRouteRule
}{
{
name: "GRPCRoute - Invalid because both percent and fraction are specified",
name: "GRPCRoute - Invalid because both percent and fraction are specified",
wantErrors: []string{"Only one of percent or fraction may be specified in HTTPRequestMirrorFilter"},
rules: []gatewayv1.GRPCRouteRule{{
Filters: []gatewayv1.GRPCRouteFilter{{
Expand All @@ -67,15 +67,15 @@ func TestGRPCRequestMirrorFilterExperimental(t *testing.T) {
},
Percent: &percent,
Fraction: &gatewayv1.Fraction{
Numerator: 83,
Numerator: 83,
Denominator: &denominator,
},
},
}},
}},
},
{
name: "GRPCRoute - Invalid fraction - numerator greater than denominator",
name: "GRPCRoute - Invalid fraction - numerator greater than denominator",
wantErrors: []string{"numerator must be less than or equal to denominator"},
rules: []gatewayv1.GRPCRouteRule{{
Filters: []gatewayv1.GRPCRouteFilter{{
Expand All @@ -86,15 +86,15 @@ func TestGRPCRequestMirrorFilterExperimental(t *testing.T) {
Port: ptrTo(gatewayv1.PortNumber(8081)),
},
Fraction: &gatewayv1.Fraction{
Numerator: 1001,
Numerator: 1001,
Denominator: &denominator,
},
},
}},
}},
},
{
name: "GRPCRoute - Invalid fraction - denominator is 0",
name: "GRPCRoute - Invalid fraction - denominator is 0",
wantErrors: []string{"spec.rules[0].filters[0].requestMirror.fraction.denominator in body should be greater than or equal to 1"},
rules: []gatewayv1.GRPCRouteRule{{
Filters: []gatewayv1.GRPCRouteFilter{{
Expand All @@ -105,15 +105,15 @@ func TestGRPCRequestMirrorFilterExperimental(t *testing.T) {
Port: ptrTo(gatewayv1.PortNumber(8081)),
},
Fraction: &gatewayv1.Fraction{
Numerator: 0,
Numerator: 0,
Denominator: &bad_denominator,
},
},
}},
}},
},
{
name: "GRPCRoute - Invalid fraction - numerator is negative",
name: "GRPCRoute - Invalid fraction - numerator is negative",
wantErrors: []string{"spec.rules[0].filters[0].requestMirror.fraction.numerator in body should be greater than or equal to 0"},
rules: []gatewayv1.GRPCRouteRule{{
Filters: []gatewayv1.GRPCRouteFilter{{
Expand All @@ -124,7 +124,7 @@ func TestGRPCRequestMirrorFilterExperimental(t *testing.T) {
Port: ptrTo(gatewayv1.PortNumber(8081)),
},
Fraction: &gatewayv1.Fraction{
Numerator: -1,
Numerator: -1,
Denominator: &denominator,
},
},
Expand Down Expand Up @@ -157,7 +157,7 @@ func TestGRPCRequestMirrorFilterExperimental(t *testing.T) {
Port: ptrTo(gatewayv1.PortNumber(8081)),
},
Fraction: &gatewayv1.Fraction{
Numerator: 83,
Numerator: 83,
Denominator: &denominator,
},
},
Expand Down
18 changes: 9 additions & 9 deletions pkg/test/cel/httproute_experimental_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ func TestHTTPRequestMirrorFilterExperimental(t *testing.T) {
rules []gatewayv1.HTTPRouteRule
}{
{
name: "HTTPRoute - Invalid because both percent and fraction are specified",
name: "HTTPRoute - Invalid because both percent and fraction are specified",
wantErrors: []string{"Only one of percent or fraction may be specified in HTTPRequestMirrorFilter"},
rules: []gatewayv1.HTTPRouteRule{{
Filters: []gatewayv1.HTTPRouteFilter{{
Expand All @@ -456,15 +456,15 @@ func TestHTTPRequestMirrorFilterExperimental(t *testing.T) {
},
Percent: &percent,
Fraction: &gatewayv1.Fraction{
Numerator: 83,
Numerator: 83,
Denominator: &denominator,
},
},
}},
}},
},
{
name: "HTTPRoute - Invalid fraction - numerator greater than denominator",
name: "HTTPRoute - Invalid fraction - numerator greater than denominator",
wantErrors: []string{"numerator must be less than or equal to denominator"},
rules: []gatewayv1.HTTPRouteRule{{
Filters: []gatewayv1.HTTPRouteFilter{{
Expand All @@ -475,15 +475,15 @@ func TestHTTPRequestMirrorFilterExperimental(t *testing.T) {
Port: ptrTo(gatewayv1.PortNumber(8081)),
},
Fraction: &gatewayv1.Fraction{
Numerator: 1001,
Numerator: 1001,
Denominator: &denominator,
},
},
}},
}},
},
{
name: "HTTPRoute - Invalid fraction - denominator is 0",
name: "HTTPRoute - Invalid fraction - denominator is 0",
wantErrors: []string{"spec.rules[0].filters[0].requestMirror.fraction.denominator in body should be greater than or equal to 1"},
rules: []gatewayv1.HTTPRouteRule{{
Filters: []gatewayv1.HTTPRouteFilter{{
Expand All @@ -494,15 +494,15 @@ func TestHTTPRequestMirrorFilterExperimental(t *testing.T) {
Port: ptrTo(gatewayv1.PortNumber(8081)),
},
Fraction: &gatewayv1.Fraction{
Numerator: 0,
Numerator: 0,
Denominator: &bad_denominator,
},
},
}},
}},
},
{
name: "HTTPRoute - Invalid fraction - numerator is negative",
name: "HTTPRoute - Invalid fraction - numerator is negative",
wantErrors: []string{"spec.rules[0].filters[0].requestMirror.fraction.numerator in body should be greater than or equal to 0"},
rules: []gatewayv1.HTTPRouteRule{{
Filters: []gatewayv1.HTTPRouteFilter{{
Expand All @@ -513,7 +513,7 @@ func TestHTTPRequestMirrorFilterExperimental(t *testing.T) {
Port: ptrTo(gatewayv1.PortNumber(8081)),
},
Fraction: &gatewayv1.Fraction{
Numerator: -1,
Numerator: -1,
Denominator: &denominator,
},
},
Expand Down Expand Up @@ -546,7 +546,7 @@ func TestHTTPRequestMirrorFilterExperimental(t *testing.T) {
Port: ptrTo(gatewayv1.PortNumber(8081)),
},
Fraction: &gatewayv1.Fraction{
Numerator: 83,
Numerator: 83,
Denominator: &denominator,
},
},
Expand Down

0 comments on commit d07c276

Please sign in to comment.