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
5eab7693
Commit
5eab7693
authored
Sep 24, 2018
by
Seth Jennings
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve pleg error msg when it has never been successful
parent
170dcc2e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
generic.go
pkg/kubelet/pleg/generic.go
+3
-0
generic_test.go
pkg/kubelet/pleg/generic_test.go
+9
-1
No files found.
pkg/kubelet/pleg/generic.go
View file @
5eab7693
...
@@ -132,6 +132,9 @@ func (g *GenericPLEG) Start() {
...
@@ -132,6 +132,9 @@ func (g *GenericPLEG) Start() {
func
(
g
*
GenericPLEG
)
Healthy
()
(
bool
,
error
)
{
func
(
g
*
GenericPLEG
)
Healthy
()
(
bool
,
error
)
{
relistTime
:=
g
.
getRelistTime
()
relistTime
:=
g
.
getRelistTime
()
if
relistTime
.
IsZero
()
{
return
false
,
fmt
.
Errorf
(
"pleg has yet to be successful"
)
}
elapsed
:=
g
.
clock
.
Since
(
relistTime
)
elapsed
:=
g
.
clock
.
Since
(
relistTime
)
if
elapsed
>
relistThreshold
{
if
elapsed
>
relistThreshold
{
return
false
,
fmt
.
Errorf
(
"pleg was last seen active %v ago; threshold is %v"
,
elapsed
,
relistThreshold
)
return
false
,
fmt
.
Errorf
(
"pleg was last seen active %v ago; threshold is %v"
,
elapsed
,
relistThreshold
)
...
...
pkg/kubelet/pleg/generic_test.go
View file @
5eab7693
...
@@ -346,9 +346,11 @@ func TestRemoveCacheEntry(t *testing.T) {
...
@@ -346,9 +346,11 @@ func TestRemoveCacheEntry(t *testing.T) {
func
TestHealthy
(
t
*
testing
.
T
)
{
func
TestHealthy
(
t
*
testing
.
T
)
{
testPleg
:=
newTestGenericPLEG
()
testPleg
:=
newTestGenericPLEG
()
// pleg should initially be unhealthy
pleg
,
_
,
clock
:=
testPleg
.
pleg
,
testPleg
.
runtime
,
testPleg
.
clock
pleg
,
_
,
clock
:=
testPleg
.
pleg
,
testPleg
.
runtime
,
testPleg
.
clock
ok
,
_
:=
pleg
.
Healthy
()
ok
,
_
:=
pleg
.
Healthy
()
assert
.
True
(
t
,
ok
,
"pleg should be
healthy"
)
assert
.
False
(
t
,
ok
,
"pleg should be un
healthy"
)
// Advance the clock without any relisting.
// Advance the clock without any relisting.
clock
.
Step
(
time
.
Minute
*
10
)
clock
.
Step
(
time
.
Minute
*
10
)
...
@@ -361,6 +363,12 @@ func TestHealthy(t *testing.T) {
...
@@ -361,6 +363,12 @@ func TestHealthy(t *testing.T) {
clock
.
Step
(
time
.
Minute
*
1
)
clock
.
Step
(
time
.
Minute
*
1
)
ok
,
_
=
pleg
.
Healthy
()
ok
,
_
=
pleg
.
Healthy
()
assert
.
True
(
t
,
ok
,
"pleg should be healthy"
)
assert
.
True
(
t
,
ok
,
"pleg should be healthy"
)
// Advance by relistThreshold without any relisting. pleg should be unhealthy
// because it has been longer than relistThreshold since a relist occurred.
clock
.
Step
(
relistThreshold
)
ok
,
_
=
pleg
.
Healthy
()
assert
.
False
(
t
,
ok
,
"pleg should be unhealthy"
)
}
}
func
TestRelistWithReinspection
(
t
*
testing
.
T
)
{
func
TestRelistWithReinspection
(
t
*
testing
.
T
)
{
...
...
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