mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
[AWS] Set max results if its not set
* If max results is not set and instance IDs are not provided for the describe instances call in the aws cloud provider, set max results. * This prevents an expensive call against the EC2 API, which can result in timeouts.
This commit is contained in:
parent
6ac2d8edc8
commit
98f26a2731
@ -960,6 +960,13 @@ func (s *awsSdkEC2) DescribeInstances(request *ec2.DescribeInstancesInput) ([]*e
|
|||||||
results := []*ec2.Instance{}
|
results := []*ec2.Instance{}
|
||||||
var nextToken *string
|
var nextToken *string
|
||||||
requestTime := time.Now()
|
requestTime := time.Now()
|
||||||
|
|
||||||
|
if request.MaxResults == nil && request.InstanceIds == nil {
|
||||||
|
// MaxResults must be set in order for pagination to work
|
||||||
|
// MaxResults cannot be set with InstanceIds
|
||||||
|
request.MaxResults = aws.Int64(1000)
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
response, err := s.ec2.DescribeInstances(request)
|
response, err := s.ec2.DescribeInstances(request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user