Skip to content

Commit 1fbf7f2

Browse files
authored
Merge pull request #9958 from tthvo/CORS-4078
CORS-4078: disable rate limiter for AWS SDK v2
2 parents 174dce1 + 5c98a08 commit 1fbf7f2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pkg/asset/installconfig/aws/sessionv2.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
survey "github.com/AlecAivazis/survey/v2"
1111
"github.com/aws/aws-sdk-go-v2/aws"
1212
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
13+
"github.com/aws/aws-sdk-go-v2/aws/ratelimit"
14+
"github.com/aws/aws-sdk-go-v2/aws/retry"
1315
"github.com/aws/aws-sdk-go-v2/config"
1416
"github.com/aws/aws-sdk-go-v2/credentials"
1517
"github.com/aws/smithy-go/middleware"
@@ -41,7 +43,17 @@ type ConfigOptions []func(*config.LoadOptions) error
4143
// getDefaultConfigOptions returns the default settings for config.LoadOptions.
4244
func getDefaultConfigOptions() ConfigOptions {
4345
return ConfigOptions{
44-
config.WithRetryMaxAttempts(RetryMaxAttempts),
46+
config.WithRetryer(func() aws.Retryer {
47+
return retry.NewStandard(func(so *retry.StandardOptions) {
48+
so.MaxAttempts = RetryMaxAttempts
49+
50+
// The SDK v2 introduces a new client-side rate-limiting mechanism in the standard retry.
51+
// The default settings are not a good fit for the installer, especially the destroy code.
52+
// Until we figure out a good settings, we disable it to align with SDK v1 behavior.
53+
// Reference: https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/configure-retries-timeouts.html
54+
so.RateLimiter = ratelimit.None
55+
})
56+
}),
4557
config.WithAPIOptions([]func(*middleware.Stack) error{
4658
awsmiddleware.AddUserAgentKeyValue(OpenShiftInstallerUserAgent, version.Raw),
4759
}),

0 commit comments

Comments
 (0)