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
ca877c5d
Commit
ca877c5d
authored
Jun 19, 2017
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Poll instead of watch for ready ReplicaSets in e2e test
parent
6b52d8f1
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 @
ca877c5d
...
...
@@ -3130,53 +3130,13 @@ func waitForReplicaSetPodsGone(c clientset.Interface, rs *extensions.ReplicaSet)
// WaitForReadyReplicaSet waits until the replica set has all of its replicas ready.
func
WaitForReadyReplicaSet
(
c
clientset
.
Interface
,
ns
,
name
string
)
error
{
rs
,
err
:=
c
.
Extensions
()
.
ReplicaSets
(
ns
)
.
Get
(
name
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
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
)
err
:=
wait
.
Poll
(
Poll
,
pollShortTimeout
,
func
()
(
bool
,
error
)
{
rs
,
err
:=
c
.
Extensions
()
.
ReplicaSets
(
ns
)
.
Get
(
name
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
false
,
err
}
return
unready
.
Len
()
==
0
,
nil
}
_
,
err
=
watch
.
Until
(
Poll
,
w
,
condition
)
return
*
(
rs
.
Spec
.
Replicas
)
==
rs
.
Status
.
Replicas
&&
*
(
rs
.
Spec
.
Replicas
)
==
rs
.
Status
.
ReadyReplicas
,
nil
})
if
err
==
wait
.
ErrWaitTimeout
{
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