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

api: support upstream max requests per connection #2513

Merged
merged 3 commits into from
Jan 30, 2024
Merged
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
8 changes: 8 additions & 0 deletions api/v1alpha1/circuitbreaker_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,12 @@ type CircuitBreaker struct {
// +kubebuilder:default=1024
// +optional
MaxParallelRequests *int64 `json:"maxParallelRequests,omitempty"`

// The maximum number of requests that Envoy will make over a single connection to the referenced backend defined within a xRoute rule.
// Default: unlimited.
//
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you highlight the default in the doc string ?

// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=4294967295
// +optional
MaxRequestsPerConnection *int64 `json:"maxRequestsPerConnection,omitempty"`
}
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ spec:
maximum: 4294967295
minimum: 0
type: integer
maxRequestsPerConnection:
description: 'The maximum number of requests that Envoy will make
over a single connection to the referenced backend defined within
a xRoute rule. Default: unlimited.'
format: int64
maximum: 4294967295
minimum: 0
type: integer
type: object
compression:
description: The compression config for the http streams.
Expand Down
1 change: 1 addition & 0 deletions site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ _Appears in:_
| `maxConnections` _integer_ | The maximum number of connections that Envoy will establish to the referenced backend defined within a xRoute rule. |
| `maxPendingRequests` _integer_ | The maximum number of pending requests that Envoy will queue to the referenced backend defined within a xRoute rule. |
| `maxParallelRequests` _integer_ | The maximum number of parallel requests that Envoy will make to the referenced backend defined within a xRoute rule. |
| `maxRequestsPerConnection` _integer_ | The maximum number of requests that Envoy will make over a single connection to the referenced backend defined within a xRoute rule. Default: unlimited. |


#### ClaimToHeader
Expand Down
8 changes: 5 additions & 3 deletions test/cel-validation/backendtrafficpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,13 +469,15 @@ func TestBackendTrafficPolicyTarget(t *testing.T) {
},
},
CircuitBreaker: &egv1a1.CircuitBreaker{
MaxConnections: valOverMax,
MaxPendingRequests: valUnderMin,
MaxParallelRequests: valOverMax,
MaxConnections: valOverMax,
MaxPendingRequests: valUnderMin,
MaxParallelRequests: valOverMax,
MaxRequestsPerConnection: valUnderMin,
},
}
},
wantErrors: []string{
"spec.circuitBreaker.maxRequestsPerConnection: Invalid value: -1: spec.circuitBreaker.maxRequestsPerConnection in body should be greater than or equal to 0",
"spec.circuitBreaker.maxParallelRequests: Invalid value: 4294967296: spec.circuitBreaker.maxParallelRequests in body should be less than or equal to 4294967295",
"spec.circuitBreaker.maxPendingRequests: Invalid value: -1: spec.circuitBreaker.maxPendingRequests in body should be greater than or equal to 0",
"spec.circuitBreaker.maxConnections: Invalid value: 4294967296: spec.circuitBreaker.maxConnections in body should be less than or equal to 4294967295",
Expand Down
Loading