Commit 437edead authored by Laurent Bernaille's avatar Laurent Bernaille

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).
parent 0523ad62
...@@ -164,7 +164,8 @@ func (m *GracefulTerminationManager) deleteRsFunc(rsToDelete *listItem) (bool, e ...@@ -164,7 +164,8 @@ func (m *GracefulTerminationManager) deleteRsFunc(rsToDelete *listItem) (bool, e
} }
for _, rs := range rss { for _, rs := range rss {
if rsToDelete.RealServer.Equal(rs) { 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 return false, nil
} }
klog.Infof("Deleting rs: %s", rsToDelete.String()) klog.Infof("Deleting rs: %s", rsToDelete.String())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment