mirror of https://github.com/k3s-io/k3s
replace sets.List() with sets.UnsortedList()
parent
338ee7f5d5
commit
83ada5c7bf
|
@ -1609,7 +1609,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||||
|
|
||||||
// Finish housekeeping.
|
// Finish housekeeping.
|
||||||
// TODO: these could be made more consistent.
|
// 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 {
|
if err := utilproxy.ClearUDPConntrackForIP(proxier.exec, svcIP); err != nil {
|
||||||
glog.Errorf("Failed to delete stale service IP %s connections, error: %v", svcIP, err)
|
glog.Errorf("Failed to delete stale service IP %s connections, error: %v", svcIP, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1050,7 +1050,7 @@ func TestBuildServiceMapAddRemove(t *testing.T) {
|
||||||
// the not-deleted service, because one of it's ServicePorts was deleted.
|
// 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"}
|
expectedStaleUDPServices := []string{"172.16.55.10", "172.16.55.4", "172.16.55.11", "172.16.55.12"}
|
||||||
if len(result.staleServices) != len(expectedStaleUDPServices) {
|
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 {
|
for _, ip := range expectedStaleUDPServices {
|
||||||
if !result.staleServices.Has(ip) {
|
if !result.staleServices.Has(ip) {
|
||||||
|
@ -1166,7 +1166,7 @@ func TestBuildServiceMapServiceUpdate(t *testing.T) {
|
||||||
t.Errorf("expected healthcheck ports length 1, got %v", result.hcServices)
|
t.Errorf("expected healthcheck ports length 1, got %v", result.hcServices)
|
||||||
}
|
}
|
||||||
if len(result.staleServices) != 0 {
|
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
|
// No change; make sure the service map stays the same and there are
|
||||||
|
@ -1180,7 +1180,7 @@ func TestBuildServiceMapServiceUpdate(t *testing.T) {
|
||||||
t.Errorf("expected healthcheck ports length 1, got %v", result.hcServices)
|
t.Errorf("expected healthcheck ports length 1, got %v", result.hcServices)
|
||||||
}
|
}
|
||||||
if len(result.staleServices) != 0 {
|
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
|
// And back to ClusterIP
|
||||||
|
|
|
@ -673,7 +673,7 @@ func CanUseIPVSProxier() (bool, error) {
|
||||||
loadModules := sets.NewString()
|
loadModules := sets.NewString()
|
||||||
wantModules.Insert(ipvsModules...)
|
wantModules.Insert(ipvsModules...)
|
||||||
loadModules.Insert(mods...)
|
loadModules.Insert(mods...)
|
||||||
modules := wantModules.Difference(loadModules).List()
|
modules := wantModules.Difference(loadModules).UnsortedList()
|
||||||
if len(modules) != 0 {
|
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)
|
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.
|
// Finish housekeeping.
|
||||||
// TODO: these could be made more consistent.
|
// 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 {
|
if err := utilproxy.ClearUDPConntrackForIP(proxier.exec, svcIP); err != nil {
|
||||||
glog.Errorf("Failed to delete stale service IP %s connections, error: %v", svcIP, err)
|
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) {
|
if !curEndpoints.Equal(newEndpoints) {
|
||||||
// Create new endpoints
|
// Create new endpoints
|
||||||
for _, ep := range newEndpoints.Difference(curEndpoints).List() {
|
for _, ep := range newEndpoints.Difference(curEndpoints).UnsortedList() {
|
||||||
ip, port, err := net.SplitHostPort(ep)
|
ip, port, err := net.SplitHostPort(ep)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Failed to parse endpoint: %v, error: %v", ep, err)
|
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
|
// Delete old endpoints
|
||||||
for _, ep := range curEndpoints.Difference(newEndpoints).List() {
|
for _, ep := range curEndpoints.Difference(newEndpoints).UnsortedList() {
|
||||||
ip, port, err := net.SplitHostPort(ep)
|
ip, port, err := net.SplitHostPort(ep)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Failed to parse endpoint: %v, error: %v", ep, err)
|
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)
|
proxier.loadBalancer.DeleteService(serviceName)
|
||||||
}
|
}
|
||||||
for _, svcIP := range staleUDPServices.List() {
|
for _, svcIP := range staleUDPServices.UnsortedList() {
|
||||||
if err := utilproxy.ClearUDPConntrackForIP(proxier.exec, svcIP); err != nil {
|
if err := utilproxy.ClearUDPConntrackForIP(proxier.exec, svcIP); err != nil {
|
||||||
glog.Errorf("Failed to delete stale service IP %s connections, error: %v", svcIP, err)
|
glog.Errorf("Failed to delete stale service IP %s connections, error: %v", svcIP, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1130,7 +1130,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||||
|
|
||||||
// Finish housekeeping.
|
// Finish housekeeping.
|
||||||
// TODO: these could be made more consistent.
|
// 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
|
// TODO : Check if this is required to cleanup stale services here
|
||||||
glog.V(5).Infof("Pending delete stale service IP %s connections", svcIP)
|
glog.V(5).Infof("Pending delete stale service IP %s connections", svcIP)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue