From 9ff06857221d86360b5370379ac2cda18492e3d7 Mon Sep 17 00:00:00 2001 From: Laurent Bernaille Date: Wed, 1 May 2019 18:36:59 +0200 Subject: [PATCH] [proxier/ipvs] Disable graceful termination for udp --- pkg/proxy/ipvs/graceful_termination.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/proxy/ipvs/graceful_termination.go b/pkg/proxy/ipvs/graceful_termination.go index 4fad4ba1d2..712ba03778 100644 --- a/pkg/proxy/ipvs/graceful_termination.go +++ b/pkg/proxy/ipvs/graceful_termination.go @@ -17,10 +17,10 @@ limitations under the License. package ipvs import ( + "fmt" "sync" "time" - "fmt" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/klog" utilipvs "k8s.io/kubernetes/pkg/util/ipvs" @@ -164,10 +164,10 @@ func (m *GracefulTerminationManager) deleteRsFunc(rsToDelete *listItem) (bool, e } for _, rs := range rss { if rsToDelete.RealServer.Equal(rs) { - // Delete RS with no connections - // For UDP, ActiveConn is always 0 - // For TCP, InactiveConn are connections not in ESTABLISHED state - if rs.ActiveConn+rs.InactiveConn != 0 { + // For UDP traffic, no graceful termination, we immediately delete the RS + // (existing connections will be deleted on the next packet because sysctlExpireNoDestConn=1) + // For other protocols, don't delete until all connections have expired) + if rsToDelete.VirtualServer.Protocol != "udp" && rs.ActiveConn+rs.InactiveConn != 0 { klog.Infof("Not deleting, RS %v: %v ActiveConn, %v InactiveConn", rsToDelete.String(), rs.ActiveConn, rs.InactiveConn) return false, nil }