diff --git a/api/v1alpha1/healthcheck_types.go b/api/v1alpha1/healthcheck_types.go index c2dd6a4b002..61172273e3d 100644 --- a/api/v1alpha1/healthcheck_types.go +++ b/api/v1alpha1/healthcheck_types.go @@ -160,12 +160,6 @@ type TCPActiveHealthChecker struct { Receive *ActiveHealthCheckPayload `json:"receive,omitempty" yaml:"receive,omitempty"` } -// HTTPStatus defines the http status code. -// +kubebuilder:validation:Minimum=100 -// +kubebuilder:validation:Maximum=600 -// +kubebuilder:validation:ExclusiveMaximum=true -type HTTPStatus int - // ActiveHealthCheckPayloadType is the type of the payload. // +kubebuilder:validation:Enum=Text;Binary type ActiveHealthCheckPayloadType string diff --git a/api/v1alpha1/retry_types.go b/api/v1alpha1/retry_types.go index 5a955ce2ed7..1752806e830 100644 --- a/api/v1alpha1/retry_types.go +++ b/api/v1alpha1/retry_types.go @@ -14,8 +14,9 @@ type Retry struct { // NumRetries is the number of retries to be attempted. Defaults to 2. // // +optional + // +kubebuilder:validation:Minimum=0 // +kubebuilder:default=2 - NumRetries *int `json:"numRetries,omitempty"` + NumRetries *int32 `json:"numRetries,omitempty"` // RetryOn specifies the retry trigger condition. // @@ -38,10 +39,11 @@ type RetryOn struct { // HttpStatusCodes specifies the http status codes to be retried. // // +optional - HTTPStatusCodes []int `json:"httpStatusCodes,omitempty"` + HTTPStatusCodes []HTTPStatus `json:"httpStatusCodes,omitempty"` } // TriggerEnum specifies the conditions that trigger retries. +// +kubebuilder:validation:Enum={"5xx","gateway-error","disconnect-reset","connect-failure","retriable-4xx","refused-stream","retriable-status-codes","cancelled","deadline-exceeded","internal","resource-exhausted","unavailable"} type TriggerEnum string const ( @@ -86,11 +88,6 @@ type PerRetryPolicy struct { // +optional // +kubebuilder:validation:Format=duration Timeout *metav1.Duration `json:"timeout,omitempty"` - // IdleTimeout is the upstream idle timeout per retry attempt.This parameter is optional and if absent there is no per try idle timeout. - // - // +optional - // +kubebuilder:validation:Format=duration - IdleTimeout *metav1.Duration `json:"idleTimeout,omitempty"` // Backoff is the backoff policy to be applied per retry attempt. gateway uses a fully jittered exponential // back-off algorithm for retries. For additional details, // see https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/router_filter#config-http-filters-router-x-envoy-max-retries diff --git a/api/v1alpha1/shared_types.go b/api/v1alpha1/shared_types.go index e0b24559104..970c62ba6a1 100644 --- a/api/v1alpha1/shared_types.go +++ b/api/v1alpha1/shared_types.go @@ -364,3 +364,9 @@ type KubernetesHorizontalPodAutoscalerSpec struct { // +optional Behavior *autoscalingv2.HorizontalPodAutoscalerBehavior `json:"behavior,omitempty"` } + +// HTTPStatus defines the http status code. +// +kubebuilder:validation:Minimum=100 +// +kubebuilder:validation:Maximum=600 +// +kubebuilder:validation:ExclusiveMaximum=true +type HTTPStatus int diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 8aa7addfd58..d38d710885d 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -2549,11 +2549,6 @@ func (in *PerRetryPolicy) DeepCopyInto(out *PerRetryPolicy) { *out = new(v1.Duration) **out = **in } - if in.IdleTimeout != nil { - in, out := &in.IdleTimeout, &out.IdleTimeout - *out = new(v1.Duration) - **out = **in - } if in.BackOff != nil { in, out := &in.BackOff, &out.BackOff *out = new(BackOffPolicy) @@ -3078,7 +3073,7 @@ func (in *Retry) DeepCopyInto(out *Retry) { *out = *in if in.NumRetries != nil { in, out := &in.NumRetries, &out.NumRetries - *out = new(int) + *out = new(int32) **out = **in } if in.RetryOn != nil { @@ -3113,7 +3108,7 @@ func (in *RetryOn) DeepCopyInto(out *RetryOn) { } if in.HTTPStatusCodes != nil { in, out := &in.HTTPStatusCodes, &out.HTTPStatusCodes - *out = make([]int, len(*in)) + *out = make([]HTTPStatus, len(*in)) copy(*out, *in) } } 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 b24efdc2abf..2ba4265aeec 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml @@ -749,6 +749,8 @@ spec: default: 2 description: NumRetries is the number of retries to be attempted. Defaults to 2. + format: int32 + minimum: 0 type: integer perRetry: description: PerRetry is the retry policy to be applied per retry @@ -773,12 +775,6 @@ spec: format: duration type: string type: object - idleTimeout: - description: IdleTimeout is the upstream idle timeout per - retry attempt.This parameter is optional and if absent there - is no per try idle timeout. - format: duration - type: string timeout: description: Timeout is the timeout per retry attempt. format: duration @@ -792,6 +788,10 @@ spec: description: HttpStatusCodes specifies the http status codes to be retried. items: + description: HTTPStatus defines the http status code. + exclusiveMaximum: true + maximum: 600 + minimum: 100 type: integer type: array triggers: @@ -799,6 +799,19 @@ spec: items: description: TriggerEnum specifies the conditions that trigger retries. + enum: + - 5xx + - gateway-error + - disconnect-reset + - connect-failure + - retriable-4xx + - refused-stream + - retriable-status-codes + - cancelled + - deadline-exceeded + - internal + - resource-exhausted + - unavailable type: string type: array type: object diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index 6aa4801b27e..07cfc0dc8ba 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -1214,6 +1214,7 @@ HTTPStatus defines the http status code. _Appears in:_ - [HTTPActiveHealthChecker](#httpactivehealthchecker) +- [RetryOn](#retryon) @@ -1711,7 +1712,6 @@ _Appears in:_ | Field | Type | Required | Description | | --- | --- | --- | --- | | `timeout` | _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#duration-v1-meta)_ | false | Timeout is the timeout per retry attempt. | -| `idleTimeout` | _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#duration-v1-meta)_ | false | IdleTimeout is the upstream idle timeout per retry attempt.This parameter is optional and if absent there is no per try idle timeout. | | `backOff` | _[BackOffPolicy](#backoffpolicy)_ | false | Backoff is the backoff policy to be applied per retry attempt. gateway uses a fully jittered exponential back-off algorithm for retries. For additional details, see https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/router_filter#config-http-filters-router-x-envoy-max-retries | @@ -2193,7 +2193,7 @@ _Appears in:_ | Field | Type | Required | Description | | --- | --- | --- | --- | | `triggers` | _[TriggerEnum](#triggerenum) array_ | false | Triggers specifies the retry trigger condition(Http/Grpc). | -| `httpStatusCodes` | _integer array_ | false | HttpStatusCodes specifies the http status codes to be retried. | +| `httpStatusCodes` | _[HTTPStatus](#httpstatus) array_ | false | HttpStatusCodes specifies the http status codes to be retried. | #### SecurityPolicy