From 9163494e04a08552d2012485ef8e4b4c680903a6 Mon Sep 17 00:00:00 2001 From: Jonathan Mejia <37458935+caribbeantiger@users.noreply.github.com> Date: Mon, 11 Sep 2023 19:48:55 -0400 Subject: [PATCH] allocation logic update --- pkg/allocate/allocate.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/allocate/allocate.go b/pkg/allocate/allocate.go index afb5d14c4..76ac2ce64 100644 --- a/pkg/allocate/allocate.go +++ b/pkg/allocate/allocate.go @@ -119,12 +119,12 @@ func IterateForAssignment(ipnet net.IPNet, rangeStart net.IP, rangeEnd net.IP, r // within ipnet, and make sure that ip is smaller than lastIP. for ip := firstIP; ipnet.Contains(ip) && iphelpers.CompareIPs(ip, lastIP) <= 0; ip = iphelpers.IncIP(ip) { // If already reserved, skip it. - if reserved[ip.String()] { - if reserved[ip.String()] == podRef { - logging.Debugf("Found existing reservation %v with matching podRef %s", ip.String(), podRef) - } else { - continue; - } + ref, exist := reserved[ip.String()] + if exist { + if ref != podRef { + continue + } + logging.Debugf("Found existing reservation %v with matching podRef %s", ip.String(), podRef) } // If this IP is within the range of one of the excluded subnets, jump to the exluded subnet's broadcast address // and skip.