Skip to content

Commit

Permalink
retry:fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: zhaonan <[email protected]>
  • Loading branch information
zhaonan committed Dec 15, 2023
1 parent 24e2f66 commit 3c9b667
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
19 changes: 8 additions & 11 deletions api/v1alpha1/retrystragegy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ type RetryStrategy struct {
// NumRetries is the number of retries to be attempted. Defaults to 0. If nonzero, maxBudget is ignored.
//
// +optional
MaxRetries int `json:"maxRetries,omitempty"`
MaxRetries *int `json:"maxRetries,omitempty"`

// MaxBudget is specifies the limit on concurrent retries as a percentage of the sum of active requests and active pending requests.
// For example, if there are 100 active requests and the MaxBudget is set to 25, there may be 25 active retries.
// This parameter is optional. Defaults to 20%.
//
// +optional
MaxBudget int `json:"maxBudget,omitempty"`
MaxBudget *int `json:"maxBudget,omitempty"`

// Minconcurrent specifies the minimum retry concurrency allowed for the retry budget. The limit on the number of active retries may never go below this number.
// This parameter is optional. Defaults to 3.
//
// +optional
MinConcurrent int `json:"minConcurrent,omitempty"`
MinConcurrent *int `json:"minConcurrent,omitempty"`

// MaxParallel is the maximum number of parallel retries. If not specified, the default is 3. Priority lower than retry budget.
//
// +optional
MaxParallel int `json:"maxParallel,omitempty"`
MaxParallel *int `json:"maxParallel,omitempty"`

// RetryOn specifies the retry trigger condition.
//
Expand All @@ -42,7 +42,7 @@ type RetryStrategy struct {
// PerRetry is the retry policy to be applied per retry attempt.
//
// +optional
PerRetry PerRetryPolicy `json:"perRetry,omitempty"`
PerRetry *PerRetryPolicy `json:"perRetry,omitempty"`
}

type RetryOn struct {
Expand All @@ -54,13 +54,10 @@ type RetryOn struct {
// HttpStatusCodes specifies the http status codes to be retried.
//
// +optional
HttpStatusCodes []int `json:"httpStatusCodes,omitempty"`
HTTPStatusCodes []int `json:"httpStatusCodes,omitempty"`
}

// RetryStrategyType specifies the types of RetryStrategy.
// +kubebuilder:validation:Enum=Grpc;Http;
type RetryStrategyType string

// TriggerEnum specifies the conditions that trigger retries.
type TriggerEnum string

const (
Expand Down Expand Up @@ -96,7 +93,7 @@ const (
// The gRPC status code in the response headers is “resource-exhausted”.
ResourceExhausted TriggerEnum = "resource-exhausted"
// The gRPC status code in the response headers is “unavailable”.
unavailable TriggerEnum = "unavailable"
Unavailable TriggerEnum = "unavailable"
)

type PerRetryPolicy struct {
Expand Down
30 changes: 27 additions & 3 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 @@ -332,6 +332,8 @@ spec:
triggers:
description: Triggers specifies the retry trigger condition(Http/Grpc).
items:
description: TriggerEnum specifies the conditions that trigger
retries.
type: string
type: array
type: object
Expand Down
2 changes: 1 addition & 1 deletion site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -1857,7 +1857,7 @@ _Appears in:_

_Underlying type:_ `string`


TriggerEnum specifies the conditions that trigger retries.

_Appears in:_
- [RetryOn](#retryon)
Expand Down

0 comments on commit 3c9b667

Please sign in to comment.