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
e6b9b5e0
Commit
e6b9b5e0
authored
Dec 18, 2017
by
m1093782566
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add not found error for ipset set and entry delete
parent
65a7ecf1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
ipset.go
pkg/proxy/ipvs/ipset.go
+3
-1
proxier.go
pkg/proxy/ipvs/proxier.go
+4
-1
ipset.go
pkg/util/ipset/ipset.go
+16
-0
No files found.
pkg/proxy/ipvs/ipset.go
View file @
e6b9b5e0
...
...
@@ -114,7 +114,9 @@ func (set *IPSet) syncIPSetEntries() {
// Clean legacy entries
for
_
,
entry
:=
range
currentIPSetEntries
.
Difference
(
set
.
activeEntries
)
.
List
()
{
if
err
:=
set
.
handle
.
DelEntry
(
entry
,
set
.
Name
);
err
!=
nil
{
glog
.
Errorf
(
"Failed to delete ip set entry: %s from ip set: %s, error: %v"
,
entry
,
set
.
Name
,
err
)
if
!
utilipset
.
IsNotFoundError
(
err
)
{
glog
.
Errorf
(
"Failed to delete ip set entry: %s from ip set: %s, error: %v"
,
entry
,
set
.
Name
,
err
)
}
}
else
{
glog
.
V
(
3
)
.
Infof
(
"Successfully delete legacy ip set entry: %s from ip set: %s"
,
entry
,
set
.
Name
)
}
...
...
pkg/proxy/ipvs/proxier.go
View file @
e6b9b5e0
...
...
@@ -824,7 +824,10 @@ func CleanupLeftovers(ipvs utilipvs.Interface, ipt utiliptables.Interface, ipset
for
_
,
set
:=
range
ipSetsToDestroy
{
err
=
ipset
.
DestroySet
(
set
)
if
err
!=
nil
{
encounteredError
=
true
if
!
utilipset
.
IsNotFoundError
(
err
)
{
glog
.
Errorf
(
"Error removing ipset %s, error: %v"
,
set
,
err
)
encounteredError
=
true
}
}
}
return
encounteredError
...
...
pkg/util/ipset/ipset.go
View file @
e6b9b5e0
...
...
@@ -322,4 +322,20 @@ func validatePortRange(portRange string) bool {
return
true
}
// IsNotFoundError returns true if the error indicates "not found". It parses
// the error string looking for known values, which is imperfect but works in
// practice.
func
IsNotFoundError
(
err
error
)
bool
{
es
:=
err
.
Error
()
if
strings
.
Contains
(
es
,
"does not exist"
)
{
// set with the same name already exists
return
true
}
if
strings
.
Contains
(
es
,
"element is missing"
)
{
// entry is missing from the set
return
true
}
return
false
}
var
_
=
Interface
(
&
runner
{})
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