mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Init ipvsInterface only when ipvs modules are present
This commit is contained in:
parent
09c9ecd3fd
commit
ff8b70c409
@ -92,9 +92,11 @@ func newProxyServer(
|
|||||||
|
|
||||||
dbus = utildbus.New()
|
dbus = utildbus.New()
|
||||||
iptInterface = utiliptables.New(execer, dbus, protocol)
|
iptInterface = utiliptables.New(execer, dbus, protocol)
|
||||||
ipvsInterface = utilipvs.New(execer)
|
|
||||||
kernelHandler = ipvs.NewLinuxKernelHandler()
|
kernelHandler = ipvs.NewLinuxKernelHandler()
|
||||||
ipsetInterface = utilipset.New(execer)
|
ipsetInterface = utilipset.New(execer)
|
||||||
|
if canUse, _ := ipvs.CanUseIPVSProxier(kernelHandler, ipsetInterface); canUse {
|
||||||
|
ipvsInterface = utilipvs.New(execer)
|
||||||
|
}
|
||||||
|
|
||||||
// We omit creation of pretty much everything if we run in cleanup mode
|
// We omit creation of pretty much everything if we run in cleanup mode
|
||||||
if cleanupAndExit {
|
if cleanupAndExit {
|
||||||
|
@ -547,6 +547,9 @@ func cleanupIptablesLeftovers(ipt utiliptables.Interface) (encounteredError bool
|
|||||||
|
|
||||||
// CleanupLeftovers clean up all ipvs and iptables rules created by ipvs Proxier.
|
// CleanupLeftovers clean up all ipvs and iptables rules created by ipvs Proxier.
|
||||||
func CleanupLeftovers(ipvs utilipvs.Interface, ipt utiliptables.Interface, ipset utilipset.Interface, cleanupIPVS bool) (encounteredError bool) {
|
func CleanupLeftovers(ipvs utilipvs.Interface, ipt utiliptables.Interface, ipset utilipset.Interface, cleanupIPVS bool) (encounteredError bool) {
|
||||||
|
if canUse, _ := CanUseIPVSProxier(NewLinuxKernelHandler(), ipset); !canUse {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if cleanupIPVS {
|
if cleanupIPVS {
|
||||||
// Return immediately when ipvs interface is nil - Probably initialization failed in somewhere.
|
// Return immediately when ipvs interface is nil - Probably initialization failed in somewhere.
|
||||||
if ipvs == nil {
|
if ipvs == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user