diff --git a/pkg/proxy/ipvs/graceful_termination.go b/pkg/proxy/ipvs/graceful_termination.go index a705bb9585d..4d53d4ee7b9 100644 --- a/pkg/proxy/ipvs/graceful_termination.go +++ b/pkg/proxy/ipvs/graceful_termination.go @@ -168,6 +168,7 @@ func (m *GracefulTerminationManager) deleteRsFunc(rsToDelete *listItem) (bool, e // For UDP, ActiveConn is always 0 // For TCP, InactiveConn are connections not in ESTABLISHED state if rs.ActiveConn+rs.InactiveConn != 0 { + klog.Infof("Not deleting, RS %v: %v ActiveConn, %v InactiveConn", rsToDelete.String(), rs.ActiveConn, rs.InactiveConn) return false, nil } klog.Infof("Deleting rs: %s", rsToDelete.String()) diff --git a/pkg/proxy/ipvs/proxier.go b/pkg/proxy/ipvs/proxier.go index 66883e18dc3..3ea8ec04ed3 100644 --- a/pkg/proxy/ipvs/proxier.go +++ b/pkg/proxy/ipvs/proxier.go @@ -1643,6 +1643,10 @@ func (proxier *Proxier) cleanLegacyService(activeServices map[string]bool, curre // Applying graceful termination to all real servers for _, rs := range rsList { uniqueRS := GetUniqueRSName(svc, rs) + // If RS is already in the graceful termination list, no need to add it again + if proxier.gracefuldeleteManager.InTerminationList(uniqueRS) { + continue + } klog.V(5).Infof("Using graceful delete to delete: %v", uniqueRS) if err := proxier.gracefuldeleteManager.GracefulDeleteRS(svc, rs); err != nil { klog.Errorf("Failed to delete destination: %v, error: %v", uniqueRS, err)