mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-08-09 00:10:46 +00:00
GetAllLocalAddressesExcept previously iterated over net.Interfaces() and called iface.Addrs() for each interface. iface.Addrs() internally performs a full RTM_GETADDR netlink dump for the entire node and then filters in user space. With many interfaces and many addresses (for example tens of thousands of ClusterIPs bound to kube-ipvs0) the cost is O(N_interfaces * N_addresses) and dominates syncProxyRules latency. This change replaces the per-interface loop with a single netlink.AddrList(nil, unix.AF_UNSPEC) call that dumps all addresses on the node in one RTM_GETADDR request, then filters by LinkIndex in user space. This makes the call O(N_addresses) and avoids the per-interface fan-out. On a production node with 251 interfaces and 19757 addresses, this reduces GetAllLocalAddressesExcept latency from 34.8s to 60ms (~705x).
6.9 KiB
6.9 KiB