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
fc582d4b
Commit
fc582d4b
authored
Jun 19, 2017
by
Kubernetes Submit Queue
Committed by
GitHub
Jun 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #47756 from janetkuo/e2e-wait-rs-ready
Automatic merge from submit-queue Poll instead of watch for ready ReplicaSets in e2e test xref #47697
parents
d066dd79
ca877c5d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
46 deletions
+6
-46
util.go
test/e2e/framework/util.go
+6
-46
No files found.
test/e2e/framework/util.go
View file @
fc582d4b
...
@@ -3130,53 +3130,13 @@ func waitForReplicaSetPodsGone(c clientset.Interface, rs *extensions.ReplicaSet)
...
@@ -3130,53 +3130,13 @@ func waitForReplicaSetPodsGone(c clientset.Interface, rs *extensions.ReplicaSet)
// WaitForReadyReplicaSet waits until the replica set has all of its replicas ready.
// WaitForReadyReplicaSet waits until the replica set has all of its replicas ready.
func
WaitForReadyReplicaSet
(
c
clientset
.
Interface
,
ns
,
name
string
)
error
{
func
WaitForReadyReplicaSet
(
c
clientset
.
Interface
,
ns
,
name
string
)
error
{
rs
,
err
:=
c
.
Extensions
()
.
ReplicaSets
(
ns
)
.
Get
(
name
,
metav1
.
GetOptions
{})
err
:=
wait
.
Poll
(
Poll
,
pollShortTimeout
,
func
()
(
bool
,
error
)
{
if
err
!=
nil
{
rs
,
err
:=
c
.
Extensions
()
.
ReplicaSets
(
ns
)
.
Get
(
name
,
metav1
.
GetOptions
{})
return
err
if
err
!=
nil
{
}
return
false
,
err
selector
,
err
:=
metav1
.
LabelSelectorAsSelector
(
rs
.
Spec
.
Selector
)
if
err
!=
nil
{
return
err
}
options
:=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
podList
,
err
:=
c
.
Core
()
.
Pods
(
rs
.
Namespace
)
.
List
(
options
)
if
err
!=
nil
{
return
err
}
readyPods
:=
int32
(
0
)
unready
:=
sets
.
NewString
()
for
i
:=
range
podList
.
Items
{
pod
:=
podList
.
Items
[
i
]
if
podutil
.
IsPodReady
(
&
pod
)
{
readyPods
++
}
else
{
unready
.
Insert
(
pod
.
Name
)
}
}
// All pods for our replica set are ready.
if
*
(
rs
.
Spec
.
Replicas
)
==
rs
.
Status
.
Replicas
&&
*
(
rs
.
Spec
.
Replicas
)
==
readyPods
{
return
nil
}
options
.
ResourceVersion
=
podList
.
ResourceVersion
w
,
err
:=
c
.
Core
()
.
Pods
(
ns
)
.
Watch
(
options
)
if
err
!=
nil
{
return
err
}
defer
w
.
Stop
()
condition
:=
func
(
event
watch
.
Event
)
(
bool
,
error
)
{
if
event
.
Type
!=
watch
.
Modified
{
return
false
,
nil
}
pod
:=
event
.
Object
.
(
*
v1
.
Pod
)
if
podutil
.
IsPodReady
(
pod
)
&&
unready
.
Has
(
pod
.
Name
)
{
unready
.
Delete
(
pod
.
Name
)
}
}
return
unready
.
Len
()
==
0
,
nil
return
*
(
rs
.
Spec
.
Replicas
)
==
rs
.
Status
.
Replicas
&&
*
(
rs
.
Spec
.
Replicas
)
==
rs
.
Status
.
ReadyReplicas
,
nil
}
})
_
,
err
=
watch
.
Until
(
Poll
,
w
,
condition
)
if
err
==
wait
.
ErrWaitTimeout
{
if
err
==
wait
.
ErrWaitTimeout
{
err
=
fmt
.
Errorf
(
"replica set %q never became ready"
,
name
)
err
=
fmt
.
Errorf
(
"replica set %q never became ready"
,
name
)
}
}
...
...
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