[kube-proxy/ipvs] 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).
pull/564/head
Laurent Bernaille 2018-11-28 17:16:42 +01:00
parent b955634d99
commit ed65f6edeb
1 changed files with 2 additions and 1 deletions

View File

@ -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())