move AddToNodeAddresses to k8s.io/cloud-provider/node/helpers

Co-authored-by: Weibin Lin <linweibin1@huawei.com>
This commit is contained in:
Andrew Kim
2019-02-01 13:50:25 -05:00
parent b5b627d522
commit 369fd95a9f
13 changed files with 151 additions and 167 deletions

View File

@@ -280,23 +280,6 @@ func IsStandardFinalizerName(str string) bool {
return standardFinalizers.Has(str)
}
// AddToNodeAddresses appends the NodeAddresses to the passed-by-pointer slice,
// only if they do not already exist
func AddToNodeAddresses(addresses *[]core.NodeAddress, addAddresses ...core.NodeAddress) {
for _, add := range addAddresses {
exists := false
for _, existing := range *addresses {
if existing.Address == add.Address && existing.Type == add.Type {
exists = true
break
}
}
if !exists {
*addresses = append(*addresses, add)
}
}
}
// TODO: make method on LoadBalancerStatus?
func LoadBalancerStatusEqual(l, r *core.LoadBalancerStatus) bool {
return ingressSliceEqual(l.Ingress, r.Ingress)