mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
refactor to use sets.String
This commit is contained in:
parent
b8c0314861
commit
ae102d64c4
@ -27,6 +27,7 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
pkgruntime "k8s.io/apimachinery/pkg/runtime"
|
pkgruntime "k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/runtime"
|
"k8s.io/apimachinery/pkg/util/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/apimachinery/pkg/watch"
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
@ -346,14 +347,14 @@ func getResolvedEndpoints(endpoints []string) ([]string, error) {
|
|||||||
resolvedEndpoints = append(resolvedEndpoints, endpoint)
|
resolvedEndpoints = append(resolvedEndpoints, endpoint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deduped := []string{}
|
deduped := sets.String{}
|
||||||
|
|
||||||
for _, value := range resolvedEndpoints {
|
for _, endpoint := range resolvedEndpoints {
|
||||||
if !dedupeEndpoints(value, deduped) {
|
if !deduped.Has(endpoint) {
|
||||||
deduped = append(deduped, value)
|
deduped.Insert(endpoint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return deduped, nil
|
return deduped.List(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ensureDNSRrsets ensures (idempotently, and with minimum mutations) that all of the DNS resource record sets for dnsName are consistent with endpoints.
|
/* ensureDNSRrsets ensures (idempotently, and with minimum mutations) that all of the DNS resource record sets for dnsName are consistent with endpoints.
|
||||||
|
Loading…
Reference in New Issue
Block a user