diff --git a/pkg/awsutils/awsutils.go b/pkg/awsutils/awsutils.go index 24ac975ff4..d9839c8723 100644 --- a/pkg/awsutils/awsutils.go +++ b/pkg/awsutils/awsutils.go @@ -1224,12 +1224,13 @@ func (cache *EC2InstanceMetadataCache) AllocIPAddresses(eniID string, numIPs int output, err := cache.ec2SVC.AssignPrivateIpAddressesWithContext(context.Background(), input, userAgent) awsAPILatency.WithLabelValues("AssignPrivateIpAddresses", fmt.Sprint(err != nil)).Observe(msSince(start)) if err != nil { - log.Errorf("Failed to allocate a private IP addresses on ENI %v: %v", eniID, err) - awsAPIErrInc("AssignPrivateIpAddresses", err) if containsPrivateIPAddressLimitExceededError(err) { - log.Debug("AssignPrivateIpAddresses returned PrivateIpAddressLimitExceeded") + log.Debug("AssignPrivateIpAddresses returned PrivateIpAddressLimitExceeded, but this is usually not true." + + "Returning nil, since we will check again by calling EC2 to get what addresses were assigned to the ENI.") return nil } + log.Errorf("Failed to allocate a private IP addresses on ENI %v: %v", eniID, err) + awsAPIErrInc("AssignPrivateIpAddresses", err) return errors.Wrap(err, "allocate IP address: failed to allocate a private IP address") } if output != nil {