diff --git a/pkg/agent/loadbalancer/loadbalancer.go b/pkg/agent/loadbalancer/loadbalancer.go index b15b6154aa..423c94523c 100644 --- a/pkg/agent/loadbalancer/loadbalancer.go +++ b/pkg/agent/loadbalancer/loadbalancer.go @@ -75,6 +75,7 @@ func Setup(ctx context.Context, cfg cmds.Agent) (_lb *LoadBalancer, _err error) lb.proxy.AddRoute(serviceName, &tcpproxy.DialProxy{ Addr: serviceName, DialContext: lb.dialContext, + OnDialError: onDialError, }) if err := lb.updateConfig(); err != nil { @@ -118,14 +119,14 @@ func (lb *LoadBalancer) dialContext(ctx context.Context, network, address string if err == nil { return conn, nil } - logrus.Warnf("Dial error from load balancer: %s", err) + logrus.Debugf("Dial error from load balancer: %s", err) newServer, err := lb.nextServer(targetServer) if err != nil { return nil, err } if targetServer != newServer { - logrus.Warnf("Dial context in load balancer failed over to %s", newServer) + logrus.Debugf("Dial server in load balancer failed over to %s", newServer) } if ctx.Err() != nil { return nil, ctx.Err() @@ -140,3 +141,8 @@ func (lb *LoadBalancer) dialContext(ctx context.Context, network, address string } } } + +func onDialError(src net.Conn, dstDialErr error) { + logrus.Debugf("Incoming conn %v, error dialing load balancer servers: %v", src.RemoteAddr().String(), dstDialErr) + src.Close() +}