Skip to content

Commit

Permalink
Move error log to after we check the message
Browse files Browse the repository at this point in the history
Even when AssignPrivateIpAddresses returns PrivateIpAddressLimitExceeded, we get the IPs assigned.
Stop logging this as an error since we check later in ipamd.go for the IPs and retry if none were added.
  • Loading branch information
Claes Mogren committed Aug 14, 2020
1 parent 723d18c commit 524f508
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/awsutils/awsutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 524f508

Please sign in to comment.