[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:
		@@ -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 {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user