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
ec4b4c87
Commit
ec4b4c87
authored
Oct 26, 2016
by
Kubernetes Submit Queue
Committed by
GitHub
Oct 26, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #35443 from ymqytw/fix_drain_flake
Automatic merge from submit-queue Fix drain test flake Fixes #35371
parents
3ef2158a
8a2610c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
8 deletions
+5
-8
drain.go
pkg/kubectl/cmd/drain.go
+1
-6
drain_test.go
pkg/kubectl/cmd/drain_test.go
+4
-2
No files found.
pkg/kubectl/cmd/drain.go
View file @
ec4b4c87
...
@@ -54,7 +54,6 @@ type DrainOptions struct {
...
@@ -54,7 +54,6 @@ type DrainOptions struct {
nodeInfo
*
resource
.
Info
nodeInfo
*
resource
.
Info
out
io
.
Writer
out
io
.
Writer
typer
runtime
.
ObjectTyper
typer
runtime
.
ObjectTyper
ifPrint
bool
}
}
// Takes a pod and returns a bool indicating whether or not to operate on the
// Takes a pod and returns a bool indicating whether or not to operate on the
...
@@ -198,8 +197,6 @@ func (o *DrainOptions) SetupDrain(cmd *cobra.Command, args []string) error {
...
@@ -198,8 +197,6 @@ func (o *DrainOptions) SetupDrain(cmd *cobra.Command, args []string) error {
return
err
return
err
}
}
o
.
ifPrint
=
true
r
:=
o
.
factory
.
NewBuilder
()
.
r
:=
o
.
factory
.
NewBuilder
()
.
NamespaceParam
(
cmdNamespace
)
.
DefaultNamespace
()
.
NamespaceParam
(
cmdNamespace
)
.
DefaultNamespace
()
.
ResourceNames
(
"node"
,
args
[
0
])
.
ResourceNames
(
"node"
,
args
[
0
])
.
...
@@ -422,9 +419,7 @@ func (o *DrainOptions) waitForDelete(pods []api.Pod, interval, timeout time.Dura
...
@@ -422,9 +419,7 @@ func (o *DrainOptions) waitForDelete(pods []api.Pod, interval, timeout time.Dura
for
i
,
pod
:=
range
pods
{
for
i
,
pod
:=
range
pods
{
p
,
err
:=
getPodFn
(
pod
.
Namespace
,
pod
.
Name
)
p
,
err
:=
getPodFn
(
pod
.
Namespace
,
pod
.
Name
)
if
apierrors
.
IsNotFound
(
err
)
||
(
p
!=
nil
&&
p
.
ObjectMeta
.
UID
!=
pod
.
ObjectMeta
.
UID
)
{
if
apierrors
.
IsNotFound
(
err
)
||
(
p
!=
nil
&&
p
.
ObjectMeta
.
UID
!=
pod
.
ObjectMeta
.
UID
)
{
if
o
.
ifPrint
{
cmdutil
.
PrintSuccess
(
o
.
mapper
,
false
,
o
.
out
,
"pod"
,
pod
.
Name
,
false
,
"deleted"
)
cmdutil
.
PrintSuccess
(
o
.
mapper
,
false
,
o
.
out
,
"pod"
,
pod
.
Name
,
false
,
"deleted"
)
}
continue
continue
}
else
if
err
!=
nil
{
}
else
if
err
!=
nil
{
return
false
,
err
return
false
,
err
...
...
pkg/kubectl/cmd/drain_test.go
View file @
ec4b4c87
...
@@ -621,9 +621,11 @@ func TestDeletePods(t *testing.T) {
...
@@ -621,9 +621,11 @@ func TestDeletePods(t *testing.T) {
},
},
}
}
o
:=
DrainOptions
{}
o
.
ifPrint
=
false
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
f
,
_
,
_
,
_
:=
cmdtesting
.
NewAPIFactory
()
o
:=
DrainOptions
{}
o
.
mapper
,
_
=
f
.
Object
()
o
.
out
=
os
.
Stdout
_
,
pods
:=
createPods
(
false
)
_
,
pods
:=
createPods
(
false
)
pendingPods
,
err
:=
o
.
waitForDelete
(
pods
,
test
.
interval
,
test
.
timeout
,
test
.
getPodFn
)
pendingPods
,
err
:=
o
.
waitForDelete
(
pods
,
test
.
interval
,
test
.
timeout
,
test
.
getPodFn
)
...
...
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