File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import (
1515 "time"
1616
1717 "github.com/aws/aws-sdk-go/aws"
18+ "github.com/aws/aws-sdk-go/aws/awserr"
1819 "github.com/aws/aws-sdk-go/aws/ec2metadata"
1920 "github.com/aws/aws-sdk-go/aws/session"
2021 "github.com/aws/aws-sdk-go/service/ec2"
@@ -904,10 +905,18 @@ func (nrc *NetworkRoutingController) disableSourceDestinationCheck() {
904905 },
905906 )
906907 if err != nil {
907- glog .Errorf ("Failed to disable source destination check due to: " + err .Error ())
908+ awserr := err .(awserr.Error )
909+ if awserr .Code () == "UnauthorizedOperation" {
910+ glog .Errorf ("Node does not have necessary IAM creds to modify instance attribute. So skipping disabling src-dst check." )
911+ return
912+ }
913+ glog .Errorf ("Failed to disable source destination check due to: %v" , err .Error ())
908914 } else {
909915 glog .Infof ("Disabled source destination check for the instance: " + instanceID )
910916 }
917+
918+ // to prevent EC2 rejecting API call due to API throttling give a delay between the calls
919+ time .Sleep (100 * time .Millisecond )
911920 }
912921}
913922
You can’t perform that action at this time.
0 commit comments