Closed lou-lan closed 2 weeks ago
Attention: Patch coverage is 72.41379%
with 16 lines
in your changes missing coverage. Please review.
Project coverage is 81.16%. Comparing base (
cd1badc
) to head (ba95bce
).
add the issue https://github.com/spidernet-io/spiderpool/issues/3541
add test for ipv6
Nice fix :+1::+1::+1:
please change more meaningless references of ip.IPsDiffSet to IsDiffIPSet please find more of it
spidersubnet.go
diffIps := ip.IPsDiffSet(ips1, ips2, false)
if diffIps != nil {
GinkgoWriter.Printf("inconsistent ip records in subnet %v/%v and pool %v/%v \n", subnetName, ips2, pool.Name, ips1)
continue LOOP
}
subnet_validate.go
diffSet := spiderpoolip.IPsDiffSet(poolIPs, subnetIPs, false)
if len(diffSet) != 0 {
return field.Invalid(ipsField, subnet.Spec.IPs, fmt.Sprintf("SpiderIPPool '%s' owns some IP addresses that SpiderSubnet '%s' can't control", tmpPool.Name, subnet.Name))
}
We have made some changes to the CI upgrade. If it fails now, please rebase main and try again.
Description
The function
IsDiffIPSet
is used to compareipSourceList
andipExcludeList
:The
DiffIPSet
function was previously converting the IP list (first argument) to a map, usingstring()
for the keys. This caused performance issues because:string()
is slow.net.IP
also consumes time.ipSourceList
increases, themap
grows larger, and the time required formap
insertions and deletions becomes significant.Changes
ipExcludeList
for in-place conversion, reducing the use ofmap
.FindAvailableIPs
is called to find and return an available IP immediately, speeding up the IP allocation process.Test