Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
405d5f80
Commit
405d5f80
authored
Jun 25, 2018
by
Weibin Lin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Not step into ipvs.CleanupLeftovers() if canUseIPVS's false
parent
7a9a30a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
server_others.go
cmd/kube-proxy/app/server_others.go
+8
-3
proxier.go
pkg/proxy/ipvs/proxier.go
+0
-3
No files found.
cmd/kube-proxy/app/server_others.go
View file @
405d5f80
...
...
@@ -92,7 +92,8 @@ func newProxyServer(
iptInterface
=
utiliptables
.
New
(
execer
,
dbus
,
protocol
)
kernelHandler
=
ipvs
.
NewLinuxKernelHandler
()
ipsetInterface
=
utilipset
.
New
(
execer
)
if
canUse
,
_
:=
ipvs
.
CanUseIPVSProxier
(
kernelHandler
,
ipsetInterface
);
canUse
{
canUseIPVS
,
_
:=
ipvs
.
CanUseIPVSProxier
(
kernelHandler
,
ipsetInterface
)
if
canUseIPVS
{
ipvsInterface
=
utilipvs
.
New
(
execer
)
}
...
...
@@ -178,7 +179,9 @@ func newProxyServer(
// 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.
ipvs
.
CleanupLeftovers
(
ipvsInterface
,
iptInterface
,
ipsetInterface
,
cleanupIPVS
)
if
canUseIPVS
{
ipvs
.
CleanupLeftovers
(
ipvsInterface
,
iptInterface
,
ipsetInterface
,
cleanupIPVS
)
}
}
else
if
proxyMode
==
proxyModeIPVS
{
glog
.
V
(
0
)
.
Info
(
"Using ipvs Proxier."
)
proxierIPVS
,
err
:=
ipvs
.
NewProxier
(
...
...
@@ -245,7 +248,9 @@ func newProxyServer(
// 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.
ipvs
.
CleanupLeftovers
(
ipvsInterface
,
iptInterface
,
ipsetInterface
,
cleanupIPVS
)
if
canUseIPVS
{
ipvs
.
CleanupLeftovers
(
ipvsInterface
,
iptInterface
,
ipsetInterface
,
cleanupIPVS
)
}
}
iptInterface
.
AddReloadFunc
(
proxier
.
Sync
)
...
...
pkg/proxy/ipvs/proxier.go
View file @
405d5f80
...
...
@@ -548,9 +548,6 @@ func cleanupIptablesLeftovers(ipt utiliptables.Interface) (encounteredError bool
// 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
)
{
if
canUse
,
_
:=
CanUseIPVSProxier
(
NewLinuxKernelHandler
(),
ipset
);
!
canUse
{
return
false
}
if
cleanupIPVS
{
// Return immediately when ipvs interface is nil - Probably initialization failed in somewhere.
if
ipvs
==
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment