Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9163494

Browse files
committedSep 11, 2023
allocation logic update
1 parent a2cd395 commit 9163494

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎pkg/allocate/allocate.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ func IterateForAssignment(ipnet net.IPNet, rangeStart net.IP, rangeEnd net.IP, r
119119
// within ipnet, and make sure that ip is smaller than lastIP.
120120
for ip := firstIP; ipnet.Contains(ip) && iphelpers.CompareIPs(ip, lastIP) <= 0; ip = iphelpers.IncIP(ip) {
121121
// If already reserved, skip it.
122-
if reserved[ip.String()] {
123-
if reserved[ip.String()] == podRef {
124-
logging.Debugf("Found existing reservation %v with matching podRef %s", ip.String(), podRef)
125-
} else {
126-
continue;
127-
}
122+
ref, exist := reserved[ip.String()]
123+
if exist {
124+
if ref != podRef {
125+
continue
126+
}
127+
logging.Debugf("Found existing reservation %v with matching podRef %s", ip.String(), podRef)
128128
}
129129
// If this IP is within the range of one of the excluded subnets, jump to the exluded subnet's broadcast address
130130
// and skip.

0 commit comments

Comments
 (0)
Please sign in to comment.