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
dcdbc646
Commit
dcdbc646
authored
Aug 19, 2015
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RC already being deleted shouldn't fail DeleteRC
parent
61153088
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
util.go
test/e2e/util.go
+19
-7
No files found.
test/e2e/util.go
View file @
dcdbc646
...
@@ -1453,16 +1453,32 @@ func waitForPodsWithLabel(c *client.Client, ns string, label labels.Selector) (p
...
@@ -1453,16 +1453,32 @@ func waitForPodsWithLabel(c *client.Client, ns string, label labels.Selector) (p
// Delete a Replication Controller and all pods it spawned
// Delete a Replication Controller and all pods it spawned
func
DeleteRC
(
c
*
client
.
Client
,
ns
,
name
string
)
error
{
func
DeleteRC
(
c
*
client
.
Client
,
ns
,
name
string
)
error
{
By
(
fmt
.
Sprintf
(
"%v Deleting replication controller %s in namespace %s"
,
time
.
Now
(),
name
,
ns
))
By
(
fmt
.
Sprintf
(
"%v Deleting replication controller %s in namespace %s"
,
time
.
Now
(),
name
,
ns
))
rc
,
err
:=
c
.
ReplicationControllers
(
ns
)
.
Get
(
name
)
if
err
!=
nil
{
if
apierrs
.
IsNotFound
(
err
)
{
Logf
(
"RC %s was already deleted: %v"
,
name
,
err
)
return
nil
}
return
err
}
reaper
,
err
:=
kubectl
.
ReaperForReplicationController
(
c
,
10
*
time
.
Minute
)
reaper
,
err
:=
kubectl
.
ReaperForReplicationController
(
c
,
10
*
time
.
Minute
)
if
err
!=
nil
{
if
err
!=
nil
{
if
apierrs
.
IsNotFound
(
err
)
{
Logf
(
"RC %s was already deleted: %v"
,
name
,
err
)
return
nil
}
return
err
return
err
}
}
startTime
:=
time
.
Now
()
startTime
:=
time
.
Now
()
_
,
err
=
reaper
.
Stop
(
ns
,
name
,
0
,
api
.
NewDeleteOptions
(
0
))
_
,
err
=
reaper
.
Stop
(
ns
,
name
,
0
,
api
.
NewDeleteOptions
(
0
))
if
apierrs
.
IsNotFound
(
err
)
{
Logf
(
"RC %s was already deleted: %v"
,
name
,
err
)
return
nil
}
deleteRCTime
:=
time
.
Now
()
.
Sub
(
startTime
)
deleteRCTime
:=
time
.
Now
()
.
Sub
(
startTime
)
Logf
(
"Deleting RC took: %v"
,
deleteRCTime
)
Logf
(
"Deleting RC took: %v"
,
deleteRCTime
)
if
err
==
nil
{
if
err
==
nil
{
err
=
waitForRCPodsGone
(
c
,
ns
,
name
)
err
=
waitForRCPodsGone
(
c
,
rc
)
}
}
terminatePodTime
:=
time
.
Now
()
.
Sub
(
startTime
)
-
deleteRCTime
terminatePodTime
:=
time
.
Now
()
.
Sub
(
startTime
)
-
deleteRCTime
Logf
(
"Terminating RC pods took: %v"
,
terminatePodTime
)
Logf
(
"Terminating RC pods took: %v"
,
terminatePodTime
)
...
@@ -1471,13 +1487,9 @@ func DeleteRC(c *client.Client, ns, name string) error {
...
@@ -1471,13 +1487,9 @@ func DeleteRC(c *client.Client, ns, name string) error {
// waitForRCPodsGone waits until there are no pods reported under an RC's selector (because the pods
// waitForRCPodsGone waits until there are no pods reported under an RC's selector (because the pods
// have completed termination).
// have completed termination).
func
waitForRCPodsGone
(
c
*
client
.
Client
,
ns
,
name
string
)
error
{
func
waitForRCPodsGone
(
c
*
client
.
Client
,
rc
*
api
.
ReplicationController
)
error
{
rc
,
err
:=
c
.
ReplicationControllers
(
ns
)
.
Get
(
name
)
if
err
!=
nil
{
return
err
}
return
wait
.
Poll
(
poll
,
singleCallTimeout
,
func
()
(
bool
,
error
)
{
return
wait
.
Poll
(
poll
,
singleCallTimeout
,
func
()
(
bool
,
error
)
{
if
pods
,
err
:=
c
.
Pods
(
ns
)
.
List
(
labels
.
SelectorFromSet
(
rc
.
Spec
.
Selector
),
fields
.
Everything
());
err
==
nil
&&
len
(
pods
.
Items
)
==
0
{
if
pods
,
err
:=
c
.
Pods
(
rc
.
Namespace
)
.
List
(
labels
.
SelectorFromSet
(
rc
.
Spec
.
Selector
),
fields
.
Everything
());
err
==
nil
&&
len
(
pods
.
Items
)
==
0
{
return
true
,
nil
return
true
,
nil
}
}
return
false
,
nil
return
false
,
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