Unverified Commit 440b2b6e authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #61077 from islinwb/fix_ipvs_warninfo

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Init ipvsInterface only when ipvs modules are present **What this PR does / why we need it**: **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #61074 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents a7998a2a ff8b70c4
...@@ -90,9 +90,11 @@ func newProxyServer( ...@@ -90,9 +90,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 ...@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment