Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace sets.List() with sets.UnsortedList() in pkg/proxy #55568

Merged
merged 1 commit into from
Nov 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/proxy/iptables/proxier.go
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,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)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/proxy/iptables/proxier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,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) {
Expand Down Expand Up @@ -1166,7 +1166,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
Expand All @@ -1180,7 +1180,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
Expand Down
8 changes: 4 additions & 4 deletions pkg/proxy/ipvs/proxier.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/userspace/proxier.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/winkernel/proxier.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down