diff --git a/pkg/ipamd/ipamd.go b/pkg/ipamd/ipamd.go index deedcc4fff..588bc3870a 100644 --- a/pkg/ipamd/ipamd.go +++ b/pkg/ipamd/ipamd.go @@ -1457,7 +1457,7 @@ func (c *IPAMContext) eniIPPoolReconcile(ipPool []string, attachedENI awsutils.E needEC2Reconcile := true // Here we can't trust attachedENI since the IMDS metadata can be stale. We need to check with EC2 API. // IPsSimilar will exclude primary IP of the ENI that is not added to the ipPool and not available for pods to use. - if !cniutils.IPsSimilar(ipPool,attachedENIIPs) { + if !cniutils.IPsSimilar(ipPool, attachedENIIPs) { log.Warnf("Instance metadata does not match data store! ipPool: %v, metadata: %v", ipPool, attachedENIIPs) log.Debugf("We need to check the ENI status by calling the EC2 control plane.") // Call EC2 to verify IPs on this ENI diff --git a/pkg/utils/cniutils/cni_utils.go b/pkg/utils/cniutils/cni_utils.go index 5b44bb451f..bf5520d12a 100644 --- a/pkg/utils/cniutils/cni_utils.go +++ b/pkg/utils/cniutils/cni_utils.go @@ -172,7 +172,7 @@ func PrefixSimilar(prefixPool []string, eniPrefixes []*ec2.Ipv4PrefixSpecificati // IPsSimilar checks if ipPool and eniIPs are equivalent. func IPsSimilar(ipPool []string, eniIPs []*ec2.NetworkInterfacePrivateIpAddress) bool { // Here we do +1 in ipPool because eniIPs will also have primary IP which is not used by pods. - if len(ipPool) +1 != len(eniIPs) { + if len(ipPool)+1 != len(eniIPs) { return false }