Skip to content

Commit

Permalink
API fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Guy Daich <guy.daich@sap.com>
  • Loading branch information
guydc committed Feb 20, 2024
1 parent a7d4af5 commit be9470b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 28 deletions.
6 changes: 0 additions & 6 deletions api/v1alpha1/healthcheck_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 4 additions & 7 deletions api/v1alpha1/retry_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand All @@ -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 (
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions api/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 2 additions & 7 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 @@ -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
Expand All @@ -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
Expand All @@ -792,13 +788,30 @@ 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:
description: Triggers specifies the retry trigger condition(Http/Grpc).
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
Expand Down
4 changes: 2 additions & 2 deletions site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,7 @@ HTTPStatus defines the http status code.

_Appears in:_
- [HTTPActiveHealthChecker](#httpactivehealthchecker)
- [RetryOn](#retryon)



Expand Down Expand Up @@ -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 |


Expand Down Expand Up @@ -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
Expand Down

0 comments on commit be9470b

Please sign in to comment.