From 77d3a2fdc96ca1c0beb4c04f589c30fdc6330748 Mon Sep 17 00:00:00 2001 From: Ivan Makarychev Date: Wed, 28 May 2025 11:32:22 +0300 Subject: [PATCH] feat(translator): support setting previous priorities retry predicate Signed-off-by: i.makarychev --- api/v1alpha1/retry_types.go | 7 ++ api/v1alpha1/zz_generated.deepcopy.go | 5 ++ ....envoyproxy.io_backendtrafficpolicies.yaml | 7 ++ ....envoyproxy.io_envoyextensionpolicies.yaml | 7 ++ .../gateway.envoyproxy.io_envoyproxies.yaml | 28 ++++++++ ...ateway.envoyproxy.io_securitypolicies.yaml | 28 ++++++++ ....envoyproxy.io_backendtrafficpolicies.yaml | 7 ++ ....envoyproxy.io_envoyextensionpolicies.yaml | 7 ++ .../gateway.envoyproxy.io_envoyproxies.yaml | 28 ++++++++ ...ateway.envoyproxy.io_securitypolicies.yaml | 28 ++++++++ internal/gatewayapi/clustersettings.go | 2 + .../backendtrafficpolicy-with-retries.in.yaml | 2 + ...backendtrafficpolicy-with-retries.out.yaml | 3 + .../testdata/httproute-retry.in.yaml | 1 + .../testdata/httproute-retry.out.yaml | 2 + internal/ir/xds.go | 5 ++ internal/ir/zz_generated.deepcopy.go | 5 ++ internal/xds/translator/route.go | 16 +++++ .../translator/testdata/in/xds-ir/retry.yaml | 2 + .../testdata/out/xds-ir/retry.routes.yaml | 5 ++ release-notes/current.yaml | 1 + site/content/en/latest/api/extension_types.md | 1 + test/helm/gateway-crds-helm/all.out.yaml | 70 +++++++++++++++++++ .../envoy-gateway-crds.out.yaml | 70 +++++++++++++++++++ 24 files changed, 337 insertions(+) diff --git a/api/v1alpha1/retry_types.go b/api/v1alpha1/retry_types.go index b77a41218c..1bee8ce75c 100644 --- a/api/v1alpha1/retry_types.go +++ b/api/v1alpha1/retry_types.go @@ -18,6 +18,13 @@ type Retry struct { // +kubebuilder:default=2 NumRetries *int32 `json:"numRetries,omitempty"` + // NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + // that should be sent to the same priority before switching to a different one. + // If not specified or set to 0, all requests are sent to the highest priority that is healthy. + // + // +optional + NumAttemptsPerPriority *int32 `json:"numAttemptsPerPriority,omitempty"` + // RetryOn specifies the retry trigger condition. // // If not specified, the default is to retry on connect-failure,refused-stream,unavailable,cancelled,retriable-status-codes(503). diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 9039df88c6..7ef5d1d47e 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -5625,6 +5625,11 @@ func (in *Retry) DeepCopyInto(out *Retry) { *out = new(int32) **out = **in } + if in.NumAttemptsPerPriority != nil { + in, out := &in.NumAttemptsPerPriority, &out.NumAttemptsPerPriority + *out = new(int32) + **out = **in + } if in.RetryOn != nil { in, out := &in.RetryOn, &out.RetryOn *out = new(RetryOn) diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml index d6e3a6bc99..1fb904e47a 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -1414,6 +1414,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to be attempted. diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 76f7fc5098..6896bb9568 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -803,6 +803,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml index 9dee1628e1..534b622ec5 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11336,6 +11336,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number @@ -12363,6 +12370,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number @@ -13458,6 +13472,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of @@ -14489,6 +14510,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries diff --git a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml index 27534cabe4..1f3189dc98 100644 --- a/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1302,6 +1302,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to @@ -2227,6 +2234,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to @@ -3358,6 +3372,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries @@ -4464,6 +4485,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to 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 2d54b9a6c2..96aff5df2c 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -1413,6 +1413,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to be attempted. diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml index 82e63b0627..9e2e94109c 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml @@ -802,6 +802,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml index f588500c9f..57ebcaddfc 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -11335,6 +11335,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number @@ -12362,6 +12369,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number @@ -13457,6 +13471,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of @@ -14488,6 +14509,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index 535eeda93e..c2bc80a65f 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -1301,6 +1301,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to @@ -2226,6 +2233,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to @@ -3357,6 +3371,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries @@ -4463,6 +4484,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to diff --git a/internal/gatewayapi/clustersettings.go b/internal/gatewayapi/clustersettings.go index 0700a64b2f..1b2b806d99 100644 --- a/internal/gatewayapi/clustersettings.go +++ b/internal/gatewayapi/clustersettings.go @@ -504,6 +504,8 @@ func buildRetry(r *egv1a1.Retry) (*ir.Retry, error) { rt.NumRetries = ptr.To(uint32(*r.NumRetries)) } + rt.NumAttemptsPerPriority = r.NumAttemptsPerPriority + if r.RetryOn != nil { ro := &ir.RetryOn{} bro := false diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-retries.in.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-retries.in.yaml index bf2e264bf2..70a004ae6d 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-retries.in.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-retries.in.yaml @@ -132,6 +132,7 @@ backendTrafficPolicies: name: httproute-1 retry: numRetries: 5 + numAttemptsPerPriority: 4 retryOn: httpStatusCodes: - 429 @@ -169,6 +170,7 @@ backendTrafficPolicies: kind: HTTPRoute name: httproute-3 retry: + numAttemptsPerPriority: 0 perRetry: backoff: baseInterval: 2s diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-retries.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-retries.out.yaml index a94353272f..928808a505 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-retries.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-retries.out.yaml @@ -7,6 +7,7 @@ backendTrafficPolicies: namespace: default spec: retry: + numAttemptsPerPriority: 4 numRetries: 5 perRetry: backOff: @@ -77,6 +78,7 @@ backendTrafficPolicies: namespace: default spec: retry: + numAttemptsPerPriority: 0 perRetry: backOff: baseInterval: 2s @@ -571,6 +573,7 @@ xdsIR: prefix: / traffic: retry: + numAttemptsPerPriority: 4 numRetries: 5 perRetry: backOff: diff --git a/internal/gatewayapi/testdata/httproute-retry.in.yaml b/internal/gatewayapi/testdata/httproute-retry.in.yaml index a151e311b5..7d62987e74 100644 --- a/internal/gatewayapi/testdata/httproute-retry.in.yaml +++ b/internal/gatewayapi/testdata/httproute-retry.in.yaml @@ -86,6 +86,7 @@ backendTrafficPolicies: name: httproute-1 retry: numRetries: 5 + numAttemptsPerPriority: 1 retryOn: httpStatusCodes: - 429 diff --git a/internal/gatewayapi/testdata/httproute-retry.out.yaml b/internal/gatewayapi/testdata/httproute-retry.out.yaml index c7c2492c4c..47665f7203 100644 --- a/internal/gatewayapi/testdata/httproute-retry.out.yaml +++ b/internal/gatewayapi/testdata/httproute-retry.out.yaml @@ -7,6 +7,7 @@ backendTrafficPolicies: namespace: default spec: retry: + numAttemptsPerPriority: 1 numRetries: 5 perRetry: backOff: @@ -319,6 +320,7 @@ xdsIR: timeout: 3s traffic: retry: + numAttemptsPerPriority: 1 numRetries: 5 perRetry: backOff: diff --git a/internal/ir/xds.go b/internal/ir/xds.go index 08cc1cb07f..3d7fe676f1 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -2835,6 +2835,11 @@ type Retry struct { // NumRetries is the number of retries to be attempted. Defaults to 2. NumRetries *uint32 `json:"numRetries,omitempty"` + // NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + // that should be sent to the same priority before switching to a different one. + // If not specified or set to 0, all requests are sent to the highest priority that is healthy. + NumAttemptsPerPriority *int32 `json:"numAttemptsPerPriority,omitempty"` + // RetryOn specifies the retry trigger condition. RetryOn *RetryOn `json:"retryOn,omitempty"` diff --git a/internal/ir/zz_generated.deepcopy.go b/internal/ir/zz_generated.deepcopy.go index 5dda160daa..4278cb2a54 100644 --- a/internal/ir/zz_generated.deepcopy.go +++ b/internal/ir/zz_generated.deepcopy.go @@ -2995,6 +2995,11 @@ func (in *Retry) DeepCopyInto(out *Retry) { *out = new(uint32) **out = **in } + if in.NumAttemptsPerPriority != nil { + in, out := &in.NumAttemptsPerPriority, &out.NumAttemptsPerPriority + *out = new(int32) + **out = **in + } if in.RetryOn != nil { in, out := &in.RetryOn, &out.RetryOn *out = new(RetryOn) diff --git a/internal/xds/translator/route.go b/internal/xds/translator/route.go index 5298b9da97..2d61f73327 100644 --- a/internal/xds/translator/route.go +++ b/internal/xds/translator/route.go @@ -14,6 +14,7 @@ import ( corev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" routev3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" previoushost "github.com/envoyproxy/go-control-plane/envoy/extensions/retry/host/previous_hosts/v3" + previouspriority "github.com/envoyproxy/go-control-plane/envoy/extensions/retry/priority/previous_priorities/v3" matcherv3 "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/wrapperspb" @@ -642,6 +643,21 @@ func buildRetryPolicy(route *ir.HTTPRoute) (*routev3.RetryPolicy, error) { rp.NumRetries = &wrapperspb.UInt32Value{Value: *rr.NumRetries} } + if rr.NumAttemptsPerPriority != nil && *rr.NumAttemptsPerPriority > 0 { + anyCfgPriority, err := proto.ToAnyWithValidation(&previouspriority.PreviousPrioritiesConfig{ + UpdateFrequency: *rr.NumAttemptsPerPriority, + }) + if err != nil { + return nil, err + } + rp.RetryPriority = &routev3.RetryPolicy_RetryPriority{ + Name: "envoy.retry_priorities.previous_priorities", + ConfigType: &routev3.RetryPolicy_RetryPriority_TypedConfig{ + TypedConfig: anyCfgPriority, + }, + } + } + if rr.RetryOn != nil { if len(rr.RetryOn.Triggers) > 0 { if ro, err := buildRetryOn(rr.RetryOn.Triggers); err == nil { diff --git a/internal/xds/translator/testdata/in/xds-ir/retry.yaml b/internal/xds/translator/testdata/in/xds-ir/retry.yaml index a165d286fd..7b15593ef9 100644 --- a/internal/xds/translator/testdata/in/xds-ir/retry.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/retry.yaml @@ -21,6 +21,7 @@ http: traffic: retry: numRetries: 5 + numAttemptsPerPriority: 0 retryOn: httpStatusCodes: - 429 @@ -57,6 +58,7 @@ http: traffic: retry: numRetries: 5 + numAttemptsPerPriority: 3 retryOn: triggers: - reset diff --git a/internal/xds/translator/testdata/out/xds-ir/retry.routes.yaml b/internal/xds/translator/testdata/out/xds-ir/retry.routes.yaml index 69090fd662..456d6c2033 100644 --- a/internal/xds/translator/testdata/out/xds-ir/retry.routes.yaml +++ b/internal/xds/translator/testdata/out/xds-ir/retry.routes.yaml @@ -58,5 +58,10 @@ typedConfig: '@type': type.googleapis.com/envoy.extensions.retry.host.previous_hosts.v3.PreviousHostsPredicate retryOn: reset,connect-failure + retryPriority: + name: envoy.retry_priorities.previous_priorities + typedConfig: + '@type': type.googleapis.com/envoy.extensions.retry.priority.previous_priorities.v3.PreviousPrioritiesConfig + updateFrequency: 3 upgradeConfigs: - upgradeType: websocket diff --git a/release-notes/current.yaml b/release-notes/current.yaml index e58dfcc562..f20d6239c2 100644 --- a/release-notes/current.yaml +++ b/release-notes/current.yaml @@ -17,6 +17,7 @@ new features: | Added support for setting ownerreference to infra resources when enable gateway namespace mode. Added support for configuring hostname in active HTTP healthchecks. Added support for GatewayInfrastructure in gateway namespace mode. + Added support for setting previous priorities retry predicate. bug fixes: | Handle integer zone annotation values diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index b59558dbe0..354ab73e91 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -4200,6 +4200,7 @@ _Appears in:_ | Field | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `numRetries` | _integer_ | false | 2 | NumRetries is the number of retries to be attempted. Defaults to 2. | +| `numAttemptsPerPriority` | _integer_ | false | | NumAttemptsPerPriority defines the number of requests (initial attempt + retries)
that should be sent to the same priority before switching to a different one.
If not specified or set to 0, all requests are sent to the highest priority that is healthy. | | `retryOn` | _[RetryOn](#retryon)_ | false | | RetryOn specifies the retry trigger condition.
If not specified, the default is to retry on connect-failure,refused-stream,unavailable,cancelled,retriable-status-codes(503). | | `perRetry` | _[PerRetryPolicy](#perretrypolicy)_ | false | | PerRetry is the retry policy to be applied per retry attempt. | diff --git a/test/helm/gateway-crds-helm/all.out.yaml b/test/helm/gateway-crds-helm/all.out.yaml index 111971c6b6..56349e508a 100644 --- a/test/helm/gateway-crds-helm/all.out.yaml +++ b/test/helm/gateway-crds-helm/all.out.yaml @@ -19042,6 +19042,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to be attempted. @@ -21820,6 +21827,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to @@ -34741,6 +34755,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number @@ -35768,6 +35789,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number @@ -36863,6 +36891,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of @@ -37894,6 +37929,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries @@ -39738,6 +39780,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to @@ -40663,6 +40712,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to @@ -41794,6 +41850,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries @@ -42900,6 +42963,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to diff --git a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml index 1ba17b7fb2..402d7babc2 100644 --- a/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml +++ b/test/helm/gateway-crds-helm/envoy-gateway-crds.out.yaml @@ -1730,6 +1730,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to be attempted. @@ -4508,6 +4515,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to @@ -17429,6 +17443,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number @@ -18456,6 +18477,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number @@ -19551,6 +19579,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of @@ -20582,6 +20617,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries @@ -22426,6 +22468,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to @@ -23351,6 +23400,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to @@ -24482,6 +24538,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries @@ -25588,6 +25651,13 @@ spec: Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions. If not set, retry will be disabled. properties: + numAttemptsPerPriority: + description: |- + NumAttemptsPerPriority defines the number of requests (initial attempt + retries) + that should be sent to the same priority before switching to a different one. + If not specified or set to 0, all requests are sent to the highest priority that is healthy. + format: int32 + type: integer numRetries: default: 2 description: NumRetries is the number of retries to