Skip to content

Commit

Permalink
add log to help find conflict ip owner (#3191)
Browse files Browse the repository at this point in the history
Signed-off-by: bobz965 <[email protected]>
  • Loading branch information
bobz965 committed Sep 11, 2023
1 parent 7f3b1e8 commit 1c13e40
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/ipam/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ func (subnet *Subnet) GetStaticMac(podName, nicName, mac string, checkConflict b
}
if checkConflict {
if p, ok := subnet.MacToPod[mac]; ok && p != podName {
klog.Errorf("mac %s has been allocated to pod %s", mac, p)
return ErrConflict
}
}
Expand Down Expand Up @@ -235,6 +236,7 @@ func (subnet *Subnet) getV4RandomAddress(ippoolName, podName, nicName string, ma
}
ip := pool.V4Free.Allocate(skipped)
if ip == nil {
klog.Errorf("no free v4 ip in ip pool %s", ippoolName)
return nil, nil, "", ErrConflict
}

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

Expand Down

0 comments on commit 1c13e40

Please sign in to comment.