From 437edead27c66da8ba752eb597bc0bde3817866b Mon Sep 17 00:00:00 2001 From: Laurent Bernaille Date: Wed, 28 Nov 2018 17:16:42 +0100 Subject: [PATCH] Handle UDP graceful termination The current logic is to delete a RS if the number of active connections is 0. This makes sense for TCP but for UDP the number of active connections is always 0. This is an issue for DNS queries because the RS will be deleted but the IPVS connection will remain until it expires (5mn by default) and if there are a lot of DNS queries, the port will be reused and queries blackholed. Of course for this to work properly the service needs to continue to serve queries until the connections expire (this works fine with the lameduck option of coredns). --- pkg/proxy/ipvs/graceful_termination.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/proxy/ipvs/graceful_termination.go b/pkg/proxy/ipvs/graceful_termination.go index f6a8ca1a2a..2ec005afc8 100644 --- a/pkg/proxy/ipvs/graceful_termination.go +++ b/pkg/proxy/ipvs/graceful_termination.go @@ -164,7 +164,8 @@ func (m *GracefulTerminationManager) deleteRsFunc(rsToDelete *listItem) (bool, e } for _, rs := range rss { if rsToDelete.RealServer.Equal(rs) { - if rs.ActiveConn != 0 { + // Don't delete TCP RS with Active Connections or UDP RS (ActiveConn is always 0 for UDP) + if rs.ActiveConn != 0 || (rsToDelete.VirtualServer.Protocol == "UDP" && rs.InactiveConn != 0) { return false, nil } klog.Infof("Deleting rs: %s", rsToDelete.String())