Skip to content

Commit 1c13e40

Browse files
committed
add log to help find conflict ip owner (#3191)
Signed-off-by: bobz965 <zhangbingbing2_yewu@cmss.chinamobile.com>
1 parent 7f3b1e8 commit 1c13e40

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/ipam/subnet.go

+3
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ func (subnet *Subnet) GetStaticMac(podName, nicName, mac string, checkConflict b
148148
}
149149
if checkConflict {
150150
if p, ok := subnet.MacToPod[mac]; ok && p != podName {
151+
klog.Errorf("mac %s has been allocated to pod %s", mac, p)
151152
return ErrConflict
152153
}
153154
}
@@ -235,6 +236,7 @@ func (subnet *Subnet) getV4RandomAddress(ippoolName, podName, nicName string, ma
235236
}
236237
ip := pool.V4Free.Allocate(skipped)
237238
if ip == nil {
239+
klog.Errorf("no free v4 ip in ip pool %s", ippoolName)
238240
return nil, nil, "", ErrConflict
239241
}
240242

@@ -289,6 +291,7 @@ func (subnet *Subnet) getV6RandomAddress(ippoolName, podName, nicName string, ma
289291
}
290292
ip := pool.V6Free.Allocate(skipped)
291293
if ip == nil {
294+
klog.Errorf("no free v6 ip in ip pool %s", ippoolName)
292295
return nil, nil, "", ErrConflict
293296
}
294297

0 commit comments

Comments
 (0)