Skip to content

Commit

Permalink
Merge pull request #573 from Disper/retry_ratelimiter_errors
Browse files Browse the repository at this point in the history
retry exceeded infrastructure request rate limits errors
  • Loading branch information
kyma-bot authored Dec 17, 2024
2 parents 345ed1f + b9a4cde commit 764dfbf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
14 changes: 13 additions & 1 deletion pkg/gardener/gardener_error_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,24 @@ type ErrReason string

func IsRetryable(lastErrors []gardener.LastError) bool {
if len(lastErrors) > 0 &&
!gardenerhelper.HasNonRetryableErrorCode(lastErrors...) {
!gardenerhelper.HasNonRetryableErrorCode(lastErrors...) ||
HasErrorInfraRateLimitsExceeded(lastErrors...) {
return true
}
return false
}

func HasErrorInfraRateLimitsExceeded(lastErrors ...gardener.LastError) bool {
for _, lastError := range lastErrors {
for _, code := range lastError.Codes {
if code == gardener.ErrorInfraRateLimitsExceeded {
return true
}
}
}
return false
}

func ToErrReason(lastErrors ...gardener.LastError) ErrReason {
var codes []gardener.ErrorCode
var vals []string
Expand Down
14 changes: 7 additions & 7 deletions pkg/gardener/gardener_error_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ func fixRetryableErrors() []gardener.LastError {
gardener.ErrorRetryableInfraDependencies,
},
},
{
Description: "Third description - non-retryable error according to gardener API which we deliberately consider as retryable",
Codes: []gardener.ErrorCode{
gardener.ErrorInfraRateLimitsExceeded,
},
},
}
}

Expand Down Expand Up @@ -109,18 +115,12 @@ func fixNonRetryableErrors() []gardener.LastError {
},
{
Description: "Fifth description - non-retryable",
Codes: []gardener.ErrorCode{
gardener.ErrorInfraRateLimitsExceeded,
},
},
{
Description: "Sixth description - non-retryable",
Codes: []gardener.ErrorCode{
gardener.ErrorConfigurationProblem,
},
},
{
Description: "Seventh description - non-retryable",
Description: "Sixth description - non-retryable",
Codes: []gardener.ErrorCode{
gardener.ErrorProblematicWebhook,
},
Expand Down

0 comments on commit 764dfbf

Please sign in to comment.