Skip to content

Commit

Permalink
api: support upstream max requests per connection (#2513)
Browse files Browse the repository at this point in the history
* Support Max Requests Per Connection

Signed-off-by: Guy Daich <[email protected]>

* add default to comment

Signed-off-by: Guy Daich <[email protected]>

* fix gen

Signed-off-by: Guy Daich <[email protected]>

---------

Signed-off-by: Guy Daich <[email protected]>
  • Loading branch information
guydc authored Jan 30, 2024
1 parent f1a0a42 commit 236cba5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
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.
//
// +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

0 comments on commit 236cba5

Please sign in to comment.