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
fa31f65d
Commit
fa31f65d
authored
Nov 06, 2018
by
Maciej Borsz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A few improvements for DeleteResourceAndWaitForGC:
* Better error messages * Increase a timeout for removing pod to 20 minutes to handle kubelet restarts gracefully.
parent
760f7dd2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
util.go
test/e2e/framework/util.go
+17
-5
No files found.
test/e2e/framework/util.go
View file @
fa31f65d
...
@@ -3161,7 +3161,10 @@ func DeleteResourceAndWaitForGC(c clientset.Interface, kind schema.GroupKind, ns
...
@@ -3161,7 +3161,10 @@ func DeleteResourceAndWaitForGC(c clientset.Interface, kind schema.GroupKind, ns
terminatePodTime
:=
time
.
Since
(
startTime
)
-
deleteTime
terminatePodTime
:=
time
.
Since
(
startTime
)
-
deleteTime
Logf
(
"Terminating %v %s pods took: %v"
,
kind
,
name
,
terminatePodTime
)
Logf
(
"Terminating %v %s pods took: %v"
,
kind
,
name
,
terminatePodTime
)
err
=
waitForPodsGone
(
ps
,
interval
,
10
*
time
.
Minute
)
// In gce, at any point, small percentage of nodes can disappear for
// ~10 minutes due to hostError. 20 minutes should be long enough to
// restart VM in that case and delete the pod.
err
=
waitForPodsGone
(
ps
,
interval
,
20
*
time
.
Minute
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error while waiting for pods gone %s: %v"
,
name
,
err
)
return
fmt
.
Errorf
(
"error while waiting for pods gone %s: %v"
,
name
,
err
)
}
}
...
@@ -3191,21 +3194,30 @@ func waitForPodsInactive(ps *testutils.PodStore, interval, timeout time.Duration
...
@@ -3191,21 +3194,30 @@ func waitForPodsInactive(ps *testutils.PodStore, interval, timeout time.Duration
if
err
==
wait
.
ErrWaitTimeout
{
if
err
==
wait
.
ErrWaitTimeout
{
for
_
,
pod
:=
range
activePods
{
for
_
,
pod
:=
range
activePods
{
Logf
(
"
Pod %q running on %q is still active"
,
pod
.
ObjectMeta
.
Name
,
pod
.
Spec
.
NodeName
)
Logf
(
"
ERROR: Pod %q running on %q is still active"
,
pod
.
Name
,
pod
.
Spec
.
NodeName
)
}
}
return
fmt
.
Errorf
(
"there are %d active pods. E.g. %q on node %q"
,
len
(
activePods
),
activePods
[
0
]
.
ObjectMeta
.
Name
,
activePods
[
0
]
.
Spec
.
NodeName
)
return
fmt
.
Errorf
(
"there are %d active pods. E.g. %q on node %q"
,
len
(
activePods
),
activePods
[
0
]
.
Name
,
activePods
[
0
]
.
Spec
.
NodeName
)
}
}
return
err
return
err
}
}
// waitForPodsGone waits until there are no pods left in the PodStore.
// waitForPodsGone waits until there are no pods left in the PodStore.
func
waitForPodsGone
(
ps
*
testutils
.
PodStore
,
interval
,
timeout
time
.
Duration
)
error
{
func
waitForPodsGone
(
ps
*
testutils
.
PodStore
,
interval
,
timeout
time
.
Duration
)
error
{
return
wait
.
PollImmediate
(
interval
,
timeout
,
func
()
(
bool
,
error
)
{
var
pods
[]
*
v1
.
Pod
if
pods
:=
ps
.
List
();
len
(
pods
)
==
0
{
err
:=
wait
.
PollImmediate
(
interval
,
timeout
,
func
()
(
bool
,
error
)
{
if
pods
=
ps
.
List
();
len
(
pods
)
==
0
{
return
true
,
nil
return
true
,
nil
}
}
return
false
,
nil
return
false
,
nil
})
})
if
err
==
wait
.
ErrWaitTimeout
{
for
_
,
pod
:=
range
pods
{
Logf
(
"ERROR: Pod %q still exists. Node: %q"
,
pod
.
Name
,
pod
.
Spec
.
NodeName
)
}
return
fmt
.
Errorf
(
"there are %d pods left. E.g. %q on node %q"
,
len
(
pods
),
pods
[
0
]
.
Name
,
pods
[
0
]
.
Spec
.
NodeName
)
}
return
err
}
}
func
WaitForPodsReady
(
c
clientset
.
Interface
,
ns
,
name
string
,
minReadySeconds
int
)
error
{
func
WaitForPodsReady
(
c
clientset
.
Interface
,
ns
,
name
string
,
minReadySeconds
int
)
error
{
...
...
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