diff --git a/api/v1alpha1/circuitbreaker_types.go b/api/v1alpha1/circuitbreaker_types.go index d045ae09517..33d394446e2 100644 --- a/api/v1alpha1/circuitbreaker_types.go +++ b/api/v1alpha1/circuitbreaker_types.go @@ -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"` } diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index fb28e836931..86af3e9a132 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -245,6 +245,11 @@ func (in *CircuitBreaker) DeepCopyInto(out *CircuitBreaker) { *out = new(int64) **out = **in } + if in.MaxRequestsPerConnection != nil { + in, out := &in.MaxRequestsPerConnection, &out.MaxRequestsPerConnection + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CircuitBreaker. diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index 2e92a810713..ba3152ef06b 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -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. diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index f29c506c28b..ff40daa421a 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -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 diff --git a/test/cel-validation/backendtrafficpolicy_test.go b/test/cel-validation/backendtrafficpolicy_test.go index c8f2860d218..24000f51867 100644 --- a/test/cel-validation/backendtrafficpolicy_test.go +++ b/test/cel-validation/backendtrafficpolicy_test.go @@ -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",