Skip to content

Commit

Permalink
add retry to avoid fetching token failed with some transient issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wwvela committed Jul 16, 2024
1 parent 958d6fc commit 782f15b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions nodeadm/internal/aws/ecr/ecr.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ func GetAuthorizationToken(awsRegion string) (string, error) {
return "", err
}
ecrClient := ecr.NewFromConfig(awsConfig)
token, err := ecrClient.GetAuthorizationToken(context.Background(), &ecr.GetAuthorizationTokenInput{})
if err != nil {
return "", err

for i := 0; i < 3; i++ {
token, err := ecrClient.GetAuthorizationToken(context.Background(), &ecr.GetAuthorizationTokenInput{})
if err == nil {
authData := token.AuthorizationData[0].AuthorizationToken
return *authData, nil
}
}
authData := token.AuthorizationData[0].AuthorizationToken
return *authData, nil
return "", err
}

func (r *ECRRegistry) GetSandboxImage() string {
Expand Down

0 comments on commit 782f15b

Please sign in to comment.