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
8b107121
Commit
8b107121
authored
Apr 04, 2019
by
Vallery Lancey
Committed by
Vallery Lancey
Apr 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Deprecated --cleanup-ipvs flag in kube-proxy"
This reverts commit
4f1bb2bd
.
parent
8378f7bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
15 deletions
+20
-15
server.go
cmd/kube-proxy/app/server.go
+7
-3
proxier.go
pkg/proxy/ipvs/proxier.go
+13
-12
No files found.
cmd/kube-proxy/app/server.go
View file @
8b107121
...
@@ -100,8 +100,10 @@ type Options struct {
...
@@ -100,8 +100,10 @@ type Options struct {
ConfigFile
string
ConfigFile
string
// WriteConfigTo is the path where the default configuration will be written.
// WriteConfigTo is the path where the default configuration will be written.
WriteConfigTo
string
WriteConfigTo
string
// CleanupAndExit, when true, makes the proxy server clean up iptables
, ipvs, etc
rules, then exit.
// CleanupAndExit, when true, makes the proxy server clean up iptables rules, then exit.
CleanupAndExit
bool
CleanupAndExit
bool
// CleanupIPVS, when true, makes the proxy server clean up ipvs rules before running.
CleanupIPVS
bool
// WindowsService should be set to true if kube-proxy is running as a service on Windows.
// WindowsService should be set to true if kube-proxy is running as a service on Windows.
// Its corresponding flag only gets registered in Windows builds
// Its corresponding flag only gets registered in Windows builds
WindowsService
bool
WindowsService
bool
...
@@ -141,7 +143,7 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
...
@@ -141,7 +143,7 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
fs
.
BoolVar
(
&
o
.
CleanupAndExit
,
"cleanup-iptables"
,
o
.
CleanupAndExit
,
"If true cleanup iptables and ipvs rules and exit."
)
fs
.
BoolVar
(
&
o
.
CleanupAndExit
,
"cleanup-iptables"
,
o
.
CleanupAndExit
,
"If true cleanup iptables and ipvs rules and exit."
)
fs
.
MarkDeprecated
(
"cleanup-iptables"
,
"This flag is replaced by --cleanup."
)
fs
.
MarkDeprecated
(
"cleanup-iptables"
,
"This flag is replaced by --cleanup."
)
fs
.
BoolVar
(
&
o
.
CleanupAndExit
,
"cleanup"
,
o
.
CleanupAndExit
,
"If true cleanup iptables and ipvs rules and exit."
)
fs
.
BoolVar
(
&
o
.
CleanupAndExit
,
"cleanup"
,
o
.
CleanupAndExit
,
"If true cleanup iptables and ipvs rules and exit."
)
fs
.
MarkDeprecated
(
"cleanup-ipvs"
,
"This flag is replaced by --cleanup.
"
)
fs
.
BoolVar
(
&
o
.
CleanupIPVS
,
"cleanup-ipvs"
,
o
.
CleanupIPVS
,
"If true make kube-proxy cleanup ipvs rules before running. Default is true
"
)
// All flags below here are deprecated and will eventually be removed.
// All flags below here are deprecated and will eventually be removed.
...
@@ -201,6 +203,7 @@ func NewOptions() *Options {
...
@@ -201,6 +203,7 @@ func NewOptions() *Options {
metricsPort
:
ports
.
ProxyStatusPort
,
metricsPort
:
ports
.
ProxyStatusPort
,
scheme
:
scheme
.
Scheme
,
scheme
:
scheme
.
Scheme
,
codecs
:
scheme
.
Codecs
,
codecs
:
scheme
.
Codecs
,
CleanupIPVS
:
true
,
errCh
:
make
(
chan
error
),
errCh
:
make
(
chan
error
),
}
}
}
}
...
@@ -496,6 +499,7 @@ type ProxyServer struct {
...
@@ -496,6 +499,7 @@ type ProxyServer struct {
ProxyMode
string
ProxyMode
string
NodeRef
*
v1
.
ObjectReference
NodeRef
*
v1
.
ObjectReference
CleanupAndExit
bool
CleanupAndExit
bool
CleanupIPVS
bool
MetricsBindAddress
string
MetricsBindAddress
string
EnableProfiling
bool
EnableProfiling
bool
OOMScoreAdj
*
int32
OOMScoreAdj
*
int32
...
@@ -553,7 +557,7 @@ func (s *ProxyServer) Run() error {
...
@@ -553,7 +557,7 @@ func (s *ProxyServer) Run() error {
if
s
.
CleanupAndExit
{
if
s
.
CleanupAndExit
{
encounteredError
:=
userspace
.
CleanupLeftovers
(
s
.
IptInterface
)
encounteredError
:=
userspace
.
CleanupLeftovers
(
s
.
IptInterface
)
encounteredError
=
iptables
.
CleanupLeftovers
(
s
.
IptInterface
)
||
encounteredError
encounteredError
=
iptables
.
CleanupLeftovers
(
s
.
IptInterface
)
||
encounteredError
encounteredError
=
ipvs
.
CleanupLeftovers
(
s
.
IpvsInterface
,
s
.
IptInterface
,
s
.
IpsetInterface
)
||
encounteredError
encounteredError
=
ipvs
.
CleanupLeftovers
(
s
.
IpvsInterface
,
s
.
IptInterface
,
s
.
IpsetInterface
,
s
.
CleanupIPVS
)
||
encounteredError
if
encounteredError
{
if
encounteredError
{
return
errors
.
New
(
"encountered an error while tearing down rules."
)
return
errors
.
New
(
"encountered an error while tearing down rules."
)
}
}
...
...
pkg/proxy/ipvs/proxier.go
View file @
8b107121
...
@@ -590,21 +590,22 @@ func cleanupIptablesLeftovers(ipt utiliptables.Interface) (encounteredError bool
...
@@ -590,21 +590,22 @@ 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
)
(
encounteredError
bool
)
{
func
CleanupLeftovers
(
ipvs
utilipvs
.
Interface
,
ipt
utiliptables
.
Interface
,
ipset
utilipset
.
Interface
,
cleanupIPVS
bool
)
(
encounteredError
bool
)
{
// Return immediately when ipvs interface is nil - Probably initialization failed in somewhere.
if
cleanupIPVS
{
if
ipvs
==
nil
{
// Return immediately when ipvs interface is nil - Probably initialization failed in somewhere.
return
true
if
ipvs
==
nil
{
}
return
true
encounteredError
=
false
}
err
:=
ipvs
.
Flush
()
encounteredError
=
false
if
err
!=
nil
{
err
:=
ipvs
.
Flush
()
klog
.
Errorf
(
"Error flushing IPVS rules: %v"
,
err
)
if
err
!=
nil
{
encounteredError
=
true
klog
.
Errorf
(
"Error flushing IPVS rules: %v"
,
err
)
encounteredError
=
true
}
}
}
// Delete dummy interface created by ipvs Proxier.
// Delete dummy interface created by ipvs Proxier.
nl
:=
NewNetLinkHandle
(
false
)
nl
:=
NewNetLinkHandle
(
false
)
err
=
nl
.
DeleteDummyDevice
(
DefaultDummyDevice
)
err
:
=
nl
.
DeleteDummyDevice
(
DefaultDummyDevice
)
if
err
!=
nil
{
if
err
!=
nil
{
klog
.
Errorf
(
"Error deleting dummy device %s created by IPVS proxier: %v"
,
DefaultDummyDevice
,
err
)
klog
.
Errorf
(
"Error deleting dummy device %s created by IPVS proxier: %v"
,
DefaultDummyDevice
,
err
)
encounteredError
=
true
encounteredError
=
true
...
...
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