mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 14:14:39 +00:00
proxy/userspace: suppress "LoadBalancerRR: Removing endpoints" message
Don't print it when there aren't any endpoints getting removed. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1468420
This commit is contained in:
@@ -326,16 +326,23 @@ func (lb *LoadBalancerRR) OnEndpointsUpdate(oldEndpoints, endpoints *api.Endpoin
|
|||||||
for portname := range oldPortsToEndpoints {
|
for portname := range oldPortsToEndpoints {
|
||||||
svcPort := proxy.ServicePortName{NamespacedName: types.NamespacedName{Namespace: oldEndpoints.Namespace, Name: oldEndpoints.Name}, Port: portname}
|
svcPort := proxy.ServicePortName{NamespacedName: types.NamespacedName{Namespace: oldEndpoints.Namespace, Name: oldEndpoints.Name}, Port: portname}
|
||||||
if _, exists := registeredEndpoints[svcPort]; !exists {
|
if _, exists := registeredEndpoints[svcPort]; !exists {
|
||||||
glog.V(2).Infof("LoadBalancerRR: Removing endpoints for %s", svcPort)
|
lb.resetService(svcPort)
|
||||||
// Reset but don't delete.
|
|
||||||
state := lb.services[svcPort]
|
|
||||||
state.endpoints = []string{}
|
|
||||||
state.index = 0
|
|
||||||
state.affinity.affinityMap = map[string]*affinityState{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (lb *LoadBalancerRR) resetService(svcPort proxy.ServicePortName) {
|
||||||
|
// If the service is still around, reset but don't delete.
|
||||||
|
if state, ok := lb.services[svcPort]; ok {
|
||||||
|
if len(state.endpoints) > 0 {
|
||||||
|
glog.V(2).Infof("LoadBalancerRR: Removing endpoints for %s", svcPort)
|
||||||
|
state.endpoints = []string{}
|
||||||
|
}
|
||||||
|
state.index = 0
|
||||||
|
state.affinity.affinityMap = map[string]*affinityState{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (lb *LoadBalancerRR) OnEndpointsDelete(endpoints *api.Endpoints) {
|
func (lb *LoadBalancerRR) OnEndpointsDelete(endpoints *api.Endpoints) {
|
||||||
portsToEndpoints := buildPortsToEndpointsMap(endpoints)
|
portsToEndpoints := buildPortsToEndpointsMap(endpoints)
|
||||||
|
|
||||||
@@ -344,13 +351,7 @@ func (lb *LoadBalancerRR) OnEndpointsDelete(endpoints *api.Endpoints) {
|
|||||||
|
|
||||||
for portname := range portsToEndpoints {
|
for portname := range portsToEndpoints {
|
||||||
svcPort := proxy.ServicePortName{NamespacedName: types.NamespacedName{Namespace: endpoints.Namespace, Name: endpoints.Name}, Port: portname}
|
svcPort := proxy.ServicePortName{NamespacedName: types.NamespacedName{Namespace: endpoints.Namespace, Name: endpoints.Name}, Port: portname}
|
||||||
glog.V(2).Infof("LoadBalancerRR: Removing endpoints for %s", svcPort)
|
lb.resetService(svcPort)
|
||||||
// If the service is still around, reset but don't delete.
|
|
||||||
if state, ok := lb.services[svcPort]; ok {
|
|
||||||
state.endpoints = []string{}
|
|
||||||
state.index = 0
|
|
||||||
state.affinity.affinityMap = map[string]*affinityState{}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user