@@ -537,22 +537,23 @@ func (e *ec2Wrapper) getClientUsingAssumedRole(instanceRegion, roleARN, clusterN
537
537
// TODO: we should revisit the global sts endpoint and check if we should remove global endpoint
538
538
// we are not using it since the concern on availability and performance
539
539
// https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html
540
+
540
541
globalSTSEndpoint , err := endpoints .DefaultResolver ().
541
542
EndpointFor ("sts" , aws .StringValue (userStsSession .Config .Region ))
542
543
if err != nil {
543
- return nil , fmt . Errorf ("failed to get the global sts endoint for region %s: %v" ,
544
- * userStsSession . Config . Region , err )
545
- }
546
-
547
- // If the regional STS endpoint is different than the global STS endpoint then add the global sts endpoint
548
- if regionalSTSEndpoint . URL != globalSTSEndpoint . URL {
549
- globalProvider := & stscreds. AssumeRoleProvider {
550
- Client : e . createSTSClient ( userStsSession , client , regionalSTSEndpoint , sourceAcct , sourceArn ) ,
551
- RoleARN : roleARN ,
552
- Duration : time . Minute * 60 ,
544
+ e . log . Info ("failed to get the global STS Endpoint, ignoring" , "roleARN" , roleARN )
545
+ } else {
546
+ // If the regional STS endpoint is different than the global STS endpoint then add the global sts endpoint
547
+ if regionalSTSEndpoint . URL != globalSTSEndpoint . URL {
548
+ globalProvider := & stscreds. AssumeRoleProvider {
549
+ Client : e . createSTSClient ( userStsSession , client , regionalSTSEndpoint , sourceAcct , sourceArn ),
550
+ RoleARN : roleARN ,
551
+ Duration : time . Minute * 60 ,
552
+ }
553
+ providers = append ( providers , globalProvider )
553
554
}
554
- providers = append (providers , globalProvider )
555
555
}
556
+
556
557
e .log .Info ("initialized the regional/global providers" , "roleARN" , roleARN )
557
558
558
559
userStsSession .Config .Credentials = credentials .NewChainCredentials (providers )
0 commit comments