Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: increase GRPCRoute matches limit #3601

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apis/v1/grpcroute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ type GRPCRouteRule struct {
// the above criteria.
//
// +optional
// +kubebuilder:validation:MaxItems=8
// +kubebuilder:validation:MaxItems=64
Matches []GRPCRouteMatch `json:"matches,omitempty"`

// Filters define the filters that are applied to requests that match
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.

62 changes: 61 additions & 1 deletion pkg/test/cel/grpcroute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,67 @@ func TestGRPCRouteRule(t *testing.T) {
},
},
},
}
{
name: "too many matches and rules",
wantErrors: []string{"total number of matches across all rules in a route must be less than 128"},
rules: func() []gatewayv1.GRPCRouteRule {
match := gatewayv1.GRPCRouteMatch{
Headers: []gatewayv1.GRPCHeaderMatch{
{
Type: ptrTo(gatewayv1.GRPCHeaderMatchExact),
Name: "version",
Value: "v1",
},
},
Method: &gatewayv1.GRPCMethodMatch{
Type: ptrTo(gatewayv1.GRPCMethodMatchExact),
Service: ptrTo("foo"),
Method: ptrTo("bar"),
},
}

var rules []gatewayv1.GRPCRouteRule
for i := 0; i < 7; i++ { // Create 7 rules
rule := gatewayv1.GRPCRouteRule{}
for j := 0; j < 20; j++ { // Each rule has 20 matches
rule.Matches = append(rule.Matches, match)
}
rules = append(rules, rule)
}
return rules
}(),
},
{
name: "many matches and few rules",
wantErrors: nil,
rules: func() []gatewayv1.GRPCRouteRule {
match := gatewayv1.GRPCRouteMatch{
Headers: []gatewayv1.GRPCHeaderMatch{
{
Type: ptrTo(gatewayv1.GRPCHeaderMatchExact),
Name: "version",
Value: "v1",
},
},
Method: &gatewayv1.GRPCMethodMatch{
Type: ptrTo(gatewayv1.GRPCMethodMatchExact),
Service: ptrTo("foo"),
Method: ptrTo("bar"),
},
}

var rules []gatewayv1.GRPCRouteRule
for i := 0; i < 2; i++ { // Create 2 rules
rule := gatewayv1.GRPCRouteRule{}
for j := 0; j < 48; j++ { // Each rule has 48 matches
rule.Matches = append(rule.Matches, match)
}
rules = append(rules, rule)
}
return rules
}(),
}}

for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
route := &gatewayv1.GRPCRoute{
Expand Down