diff --git a/pkg/ipam/subnet.go b/pkg/ipam/subnet.go index 3d6d978067b..a0fd1aa390a 100644 --- a/pkg/ipam/subnet.go +++ b/pkg/ipam/subnet.go @@ -159,6 +159,9 @@ func (subnet *Subnet) pushPodNic(podName, nicName string) { func (subnet *Subnet) popPodNic(podName, nicName string) { subnet.PodToNicList[podName] = util.RemoveString(subnet.PodToNicList[podName], nicName) + if subnet.PodToNicList[podName] == nil { + delete(subnet.PodToNicList, podName) + } } func (subnet *Subnet) GetRandomAddress(podName, nicName string, mac string, skippedAddrs []string, checkConflict bool) (IP, IP, string, error) {