// Finds the best node to allocate the egress IP to, given the existing allocation. The
// boolean return value indicates whether multiple nodes could host the IP.
Finds the best node to allocate the egress IP to, given the existing allocation. The
boolean return value indicates whether multiple nodes could host the IP.
// Finds the best node to allocate the egress IP to given the existing allocation . The // boolean return value indicates whether multiple nodes could host the IP .
func (eit *EgressIPTracker) findEgressIPAllocation(ip net.IP, allocation map[string][]string) (string, bool) {
	bestNode := ""
	otherNodes := false
	for _, node := range eit.nodes {
		if node.offline {
			continue
		}
		egressIPs := allocation[node.nodeName]
		for _, parsed := range node.parsedCIDRs {
			if parsed.Contains(ip) {
				if bestNode != "" {
					otherNodes = true
					if len(allocation[bestNode]) < len(egressIPs) {
						break
					}
				}
				bestNode = node.nodeName
				break
			}
		}
	}
	return bestNode, otherNodes
}
func ( eit * EgressIPTracker ) findEgressIPAllocation ( ip net . IP , allocation map [ string ] [ ] string ) ( string , bool ) { bestNode := " " otherNodes := false for _ , node := range eit . nodes { if node . offline { continue } egressIPs := allocation [ node . nodeName ] for _ , parsed := range node . parsedCIDRs { if parsed . Contains ( ip ) { if bestNode != " " { otherNodes = true if len ( allocation [ bestNode ] ) < len ( egressIPs ) { break } } bestNode = node . nodeName break } } } return bestNode , otherNodes }
Finds the best node to allocate the egress IP to, given the existing allocation.
Finds the best node to allocate the egress IP to given the existing allocation .