Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default IMDS timeouts to match AWS SDK #10133

Merged
merged 7 commits into from
Oct 16, 2020
8 changes: 8 additions & 0 deletions sdk/helper/awsutil/generate_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"os"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
Expand Down Expand Up @@ -111,6 +112,13 @@ func (c *CredentialsConfig) GenerateCredentialChain() (*credentials.Credentials,
}
if c.HTTPClient != nil {
def.Config.HTTPClient = c.HTTPClient
_, checkFullURI := os.LookupEnv("AWS_CONTAINER_CREDENTIALS_FULL_URI")
_, checkRelativeURI := os.LookupEnv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI")
if !checkFullURI && !checkRelativeURI {
// match the sdk defaults from https://github.com/aws/aws-sdk-go/pull/3066
def.Config.HTTPClient.Timeout = 1 * time.Second
def.Config.MaxRetries = aws.Int(2)
}
}

providers = append(providers, defaults.RemoteCredProvider(*def.Config, def.Handlers))
Expand Down