-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy patherror_codes.go
36 lines (31 loc) · 3.14 KB
/
error_codes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0
package helper
import (
"regexp"
gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1"
)
var (
unauthenticatedRegexp = regexp.MustCompile(`(?i)(Authentication failed|invalid character|invalid_client|cannot fetch token|InvalidSecretAccessKey)`)
unauthorizedRegexp = regexp.MustCompile(`(?i)(Unauthorized|SignatureDoesNotMatch|invalid_grant|Authorization Profile was not found|no active subscriptions|not authorized|AccessDenied|Error 403|SERVICE_ACCOUNT_ACCESS_DENIED)`)
quotaExceededRegexp = regexp.MustCompile(`(?i)((?:^|[^t]|(?:[^s]|^)t|(?:[^e]|^)st|(?:[^u]|^)est|(?:[^q]|^)uest|(?:[^e]|^)quest|(?:[^r]|^)equest)LimitExceeded|Quotas|Quota.*exceeded|exceeded quota|Quota has been met|QUOTA_EXCEEDED|ZONE_RESOURCE_POOL_EXHAUSTED_WITH_DETAILS)`)
rateLimitsExceededRegexp = regexp.MustCompile(`(?i)(RequestLimitExceeded|Throttling|Too many requests)`)
dependenciesRegexp = regexp.MustCompile(`(?i)(PendingVerification|Access Not Configured|accessNotConfigured|DependencyViolation|OptInRequired|Conflict|inactive billing state|is already being used|timeout while waiting for state to become|InvalidCidrBlock|already busy for|internalerror|internal server error|A resource with the ID)`)
retryableDependenciesRegexp = regexp.MustCompile(`(?i)(RetryableError)`)
resourcesDepletedRegexp = regexp.MustCompile(`(?i)(not available in the current hardware cluster|out of stock)`)
configurationProblemRegexp = regexp.MustCompile(`(?i)(not supported in your requested Availability Zone|notFound|Invalid value|violates constraint|no attached internet gateway found|invalid VPC attributes|unrecognized feature gate|runtime-config invalid key|strict decoder error|not allowed to configure an unsupported|error during apply of object .* is invalid:|duplicate zones|overlapping zones)`)
retryableConfigurationProblemRegexp = regexp.MustCompile(`(?i)(is misconfigured and requires zero voluntary evictions|SDK.CanNotResolveEndpoint|The requested configuration is currently not supported)`)
// KnownCodes maps Gardener error codes to respective regex.
KnownCodes = map[gardencorev1beta1.ErrorCode]func(string) bool{
gardencorev1beta1.ErrorInfraUnauthenticated: unauthenticatedRegexp.MatchString,
gardencorev1beta1.ErrorInfraUnauthorized: unauthorizedRegexp.MatchString,
gardencorev1beta1.ErrorInfraQuotaExceeded: quotaExceededRegexp.MatchString,
gardencorev1beta1.ErrorInfraRateLimitsExceeded: rateLimitsExceededRegexp.MatchString,
gardencorev1beta1.ErrorInfraDependencies: dependenciesRegexp.MatchString,
gardencorev1beta1.ErrorRetryableInfraDependencies: retryableDependenciesRegexp.MatchString,
gardencorev1beta1.ErrorInfraResourcesDepleted: resourcesDepletedRegexp.MatchString,
gardencorev1beta1.ErrorConfigurationProblem: configurationProblemRegexp.MatchString,
gardencorev1beta1.ErrorRetryableConfigurationProblem: retryableConfigurationProblemRegexp.MatchString,
}
)