mirror of https://github.com/k3s-io/k3s.git
Removed cleanup for non-current kube-proxy modes in newProxyServer()
parent
66329fcea9
commit
cdce2d0ef9
|
@ -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)
|
||||
|
|
|
@ -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{
|
||||
|
|
Loading…
Reference in New Issue