-
Notifications
You must be signed in to change notification settings - Fork 77
/
error_codes.go
36 lines (31 loc) · 3.78 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)(InvalidAuthenticationTokenTenant|Authentication failed|invalid character|invalid_client|InvalidAccessKeyId|cannot fetch token|InvalidSecretAccessKey|InvalidSubscriptionId)`)
unauthorizedRegexp = regexp.MustCompile(`(?i)(Unauthorized|SignatureDoesNotMatch|AuthorizationFailed|invalid_grant|Authorization Profile was not found|no active subscriptions|not authorized|AccessDenied|OperationNotAllowed)`)
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|exceeding approved .{0,60}quota)`)
rateLimitsExceededRegexp = regexp.MustCompile(`(?i)(RequestLimitExceeded|Throttling|Too many requests)`)
dependenciesRegexp = regexp.MustCompile(`(?i)(PendingVerification|Access Not Configured|accessNotConfigured|DependencyViolation|OptInRequired|Conflict|inactive billing state|ReadOnlyDisabledSubscription|is already being used|InUseSubnetCannotBeDeleted|VnetInUse|InUseRouteTableCannotBeDeleted|timeout while waiting for state to become|InvalidCidrBlock|already busy for|InternalServerError|internal server error|A resource with the ID|VnetAddressSpaceCannotChangeDueToPeerings|InternalBillingError|NetcfgSubnetRangesOverlap)`)
retryableDependenciesRegexp = regexp.MustCompile(`(?i)(RetryableError)`)
resourcesDepletedRegexp = regexp.MustCompile(`(?i)(not available in the current hardware cluster|SkuNotAvailable|ZonalAllocationFailed|out of stock)`)
configurationProblemRegexp = regexp.MustCompile(`(?i)(AzureBastionSubnet|not supported in your requested Availability Zone|InvalidParameter|notFound|NetcfgInvalidSubnet|Invalid value|violates constraint|no attached internet gateway found|Your query returned no results|PrivateEndpointNetworkPoliciesCannotBeEnabledOnPrivateEndpointSubnet|invalid VPC attributes|PrivateLinkServiceNetworkPoliciesCannotBeEnabledOnPrivateLinkServiceSubnet|unrecognized feature gate|runtime-config invalid key|LoadBalancingRuleMustDisableSNATSinceSameFrontendIPConfigurationIsReferencedByOutboundRule|strict decoder error|not allowed to configure an unsupported|error during apply of object .* is invalid:|OverconstrainedZonalAllocationRequest|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,
}
)