From cdce2d0ef98b9f46d8efa50de2c8f3ccd5af8bd0 Mon Sep 17 00:00:00 2001 From: Vallery Lancey Date: Wed, 3 Apr 2019 15:27:21 -0700 Subject: [PATCH] Removed cleanup for non-current kube-proxy modes in newProxyServer() --- cmd/kube-proxy/app/server_others.go | 30 +--------------------------- cmd/kube-proxy/app/server_windows.go | 2 -- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/cmd/kube-proxy/app/server_others.go b/cmd/kube-proxy/app/server_others.go index d8bd8614e78..84d5ea0d07d 100644 --- a/cmd/kube-proxy/app/server_others.go +++ b/cmd/kube-proxy/app/server_others.go @@ -53,13 +53,12 @@ import ( // NewProxyServer returns a new ProxyServer. func NewProxyServer(o *Options) (*ProxyServer, error) { - return newProxyServer(o.config, o.CleanupAndExit, o.CleanupIPVS, o.scheme, o.master) + return newProxyServer(o.config, o.CleanupAndExit, o.scheme, o.master) } func newProxyServer( config *proxyconfigapi.KubeProxyConfiguration, cleanupAndExit bool, - cleanupIPVS bool, scheme *runtime.Scheme, master string) (*ProxyServer, error) { @@ -174,17 +173,6 @@ func newProxyServer( proxier = proxierIPTables serviceEventHandler = proxierIPTables endpointsEventHandler = proxierIPTables - // No turning back. Remove artifacts that might still exist from the userspace Proxier. - klog.V(0).Info("Tearing down inactive rules.") - // TODO this has side effects that should only happen when Run() is invoked. - userspace.CleanupLeftovers(iptInterface) - // IPVS Proxier will generate some iptables rules, need to clean them before switching to other proxy mode. - // Besides, ipvs proxier will create some ipvs rules as well. Because there is no way to tell if a given - // ipvs rule is created by IPVS proxier or not. Users should explicitly specify `--clean-ipvs=true` to flush - // all ipvs rules when kube-proxy start up. Users do this operation should be with caution. - if canUseIPVS { - ipvs.CleanupLeftovers(ipvsInterface, iptInterface, ipsetInterface, cleanupIPVS) - } } else if proxyMode == proxyModeIPVS { klog.V(0).Info("Using ipvs Proxier.") proxierIPVS, err := ipvs.NewProxier( @@ -214,10 +202,6 @@ func newProxyServer( proxier = proxierIPVS serviceEventHandler = proxierIPVS endpointsEventHandler = proxierIPVS - klog.V(0).Info("Tearing down inactive rules.") - // TODO this has side effects that should only happen when Run() is invoked. - userspace.CleanupLeftovers(iptInterface) - iptables.CleanupLeftovers(iptInterface) } else { klog.V(0).Info("Using userspace Proxier.") // This is a proxy.LoadBalancer which NewProxier needs but has methods we don't need for @@ -243,18 +227,6 @@ func newProxyServer( } serviceEventHandler = proxierUserspace proxier = proxierUserspace - - // Remove artifacts from the iptables and ipvs Proxier, if not on Windows. - klog.V(0).Info("Tearing down inactive rules.") - // TODO this has side effects that should only happen when Run() is invoked. - iptables.CleanupLeftovers(iptInterface) - // IPVS Proxier will generate some iptables rules, need to clean them before switching to other proxy mode. - // Besides, ipvs proxier will create some ipvs rules as well. Because there is no way to tell if a given - // ipvs rule is created by IPVS proxier or not. Users should explicitly specify `--clean-ipvs=true` to flush - // all ipvs rules when kube-proxy start up. Users do this operation should be with caution. - if canUseIPVS { - ipvs.CleanupLeftovers(ipvsInterface, iptInterface, ipsetInterface, cleanupIPVS) - } } iptInterface.AddReloadFunc(proxier.Sync) diff --git a/cmd/kube-proxy/app/server_windows.go b/cmd/kube-proxy/app/server_windows.go index 5aba6cf665a..596796cbbe1 100644 --- a/cmd/kube-proxy/app/server_windows.go +++ b/cmd/kube-proxy/app/server_windows.go @@ -144,8 +144,6 @@ func newProxyServer(config *proxyconfigapi.KubeProxyConfiguration, cleanupAndExi } proxier = proxierUserspace serviceEventHandler = proxierUserspace - klog.V(0).Info("Tearing down pure-winkernel proxy rules.") - winkernel.CleanupLeftovers() } return &ProxyServer{