mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #55568 from m1093782566/unsortlist
Automatic merge from submit-queue (batch tested with PRs 53580, 55568). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Replace sets.List() with sets.UnsortedList() in pkg/proxy **What this PR does / why we need it**: Replace sets.List() with sets.UnsortedList() in pkg/proxy - sets.List() will sort the result array, we don't need sorted array in pkg/proxy. Using sets.UnsortedList() can reduce the unnecessary overhead spending. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: @wojtek-t wdyt ^_^ **Release note**: ```release-note NONE ``` /sig network
This commit is contained in:
commit
d6cabaf706
@ -1621,7 +1621,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
|
||||
// Finish housekeeping.
|
||||
// TODO: these could be made more consistent.
|
||||
for _, svcIP := range staleServices.List() {
|
||||
for _, svcIP := range staleServices.UnsortedList() {
|
||||
if err := utilproxy.ClearUDPConntrackForIP(proxier.exec, svcIP); err != nil {
|
||||
glog.Errorf("Failed to delete stale service IP %s connections, error: %v", svcIP, err)
|
||||
}
|
||||
|
@ -1067,7 +1067,7 @@ func TestBuildServiceMapAddRemove(t *testing.T) {
|
||||
// the not-deleted service, because one of it's ServicePorts was deleted.
|
||||
expectedStaleUDPServices := []string{"172.16.55.10", "172.16.55.4", "172.16.55.11", "172.16.55.12"}
|
||||
if len(result.staleServices) != len(expectedStaleUDPServices) {
|
||||
t.Errorf("expected stale UDP services length %d, got %v", len(expectedStaleUDPServices), result.staleServices.List())
|
||||
t.Errorf("expected stale UDP services length %d, got %v", len(expectedStaleUDPServices), result.staleServices.UnsortedList())
|
||||
}
|
||||
for _, ip := range expectedStaleUDPServices {
|
||||
if !result.staleServices.Has(ip) {
|
||||
@ -1183,7 +1183,7 @@ func TestBuildServiceMapServiceUpdate(t *testing.T) {
|
||||
t.Errorf("expected healthcheck ports length 1, got %v", result.hcServices)
|
||||
}
|
||||
if len(result.staleServices) != 0 {
|
||||
t.Errorf("expected stale UDP services length 0, got %v", result.staleServices.List())
|
||||
t.Errorf("expected stale UDP services length 0, got %v", result.staleServices.UnsortedList())
|
||||
}
|
||||
|
||||
// No change; make sure the service map stays the same and there are
|
||||
@ -1197,7 +1197,7 @@ func TestBuildServiceMapServiceUpdate(t *testing.T) {
|
||||
t.Errorf("expected healthcheck ports length 1, got %v", result.hcServices)
|
||||
}
|
||||
if len(result.staleServices) != 0 {
|
||||
t.Errorf("expected stale UDP services length 0, got %v", result.staleServices.List())
|
||||
t.Errorf("expected stale UDP services length 0, got %v", result.staleServices.UnsortedList())
|
||||
}
|
||||
|
||||
// And back to ClusterIP
|
||||
|
@ -673,7 +673,7 @@ func CanUseIPVSProxier() (bool, error) {
|
||||
loadModules := sets.NewString()
|
||||
wantModules.Insert(ipvsModules...)
|
||||
loadModules.Insert(mods...)
|
||||
modules := wantModules.Difference(loadModules).List()
|
||||
modules := wantModules.Difference(loadModules).UnsortedList()
|
||||
if len(modules) != 0 {
|
||||
return false, fmt.Errorf("IPVS proxier will not be used because the following required kernel modules are not loaded: %v", modules)
|
||||
}
|
||||
@ -1254,7 +1254,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
|
||||
// Finish housekeeping.
|
||||
// TODO: these could be made more consistent.
|
||||
for _, svcIP := range staleServices.List() {
|
||||
for _, svcIP := range staleServices.UnsortedList() {
|
||||
if err := utilproxy.ClearUDPConntrackForIP(proxier.exec, svcIP); err != nil {
|
||||
glog.Errorf("Failed to delete stale service IP %s connections, error: %v", svcIP, err)
|
||||
}
|
||||
@ -1339,7 +1339,7 @@ func (proxier *Proxier) syncEndpoint(svcPortName proxy.ServicePortName, onlyNode
|
||||
|
||||
if !curEndpoints.Equal(newEndpoints) {
|
||||
// Create new endpoints
|
||||
for _, ep := range newEndpoints.Difference(curEndpoints).List() {
|
||||
for _, ep := range newEndpoints.Difference(curEndpoints).UnsortedList() {
|
||||
ip, port, err := net.SplitHostPort(ep)
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to parse endpoint: %v, error: %v", ep, err)
|
||||
@ -1363,7 +1363,7 @@ func (proxier *Proxier) syncEndpoint(svcPortName proxy.ServicePortName, onlyNode
|
||||
}
|
||||
}
|
||||
// Delete old endpoints
|
||||
for _, ep := range curEndpoints.Difference(newEndpoints).List() {
|
||||
for _, ep := range curEndpoints.Difference(newEndpoints).UnsortedList() {
|
||||
ip, port, err := net.SplitHostPort(ep)
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to parse endpoint: %v, error: %v", ep, err)
|
||||
|
@ -503,7 +503,7 @@ func (proxier *Proxier) unmergeService(service *api.Service, existingPorts sets.
|
||||
}
|
||||
proxier.loadBalancer.DeleteService(serviceName)
|
||||
}
|
||||
for _, svcIP := range staleUDPServices.List() {
|
||||
for _, svcIP := range staleUDPServices.UnsortedList() {
|
||||
if err := utilproxy.ClearUDPConntrackForIP(proxier.exec, svcIP); err != nil {
|
||||
glog.Errorf("Failed to delete stale service IP %s connections, error: %v", svcIP, err)
|
||||
}
|
||||
|
@ -1130,7 +1130,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
|
||||
// Finish housekeeping.
|
||||
// TODO: these could be made more consistent.
|
||||
for _, svcIP := range staleServices.List() {
|
||||
for _, svcIP := range staleServices.UnsortedList() {
|
||||
// TODO : Check if this is required to cleanup stale services here
|
||||
glog.V(5).Infof("Pending delete stale service IP %s connections", svcIP)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user