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
7230bd10
Commit
7230bd10
authored
Mar 11, 2016
by
Andy Goldstein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rkt GetPods() order
Use an array to store the pod IDs and use that to build the pod array with consistent ordering, instead of map ordering, which is random and causes test flakes.
parent
1c50f183
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
rkt.go
pkg/kubelet/rkt/rkt.go
+5
-3
No files found.
pkg/kubelet/rkt/rkt.go
View file @
7230bd10
...
@@ -998,6 +998,7 @@ func (r *Runtime) GetPods(all bool) ([]*kubecontainer.Pod, error) {
...
@@ -998,6 +998,7 @@ func (r *Runtime) GetPods(all bool) ([]*kubecontainer.Pod, error) {
}
}
pods
:=
make
(
map
[
types
.
UID
]
*
kubecontainer
.
Pod
)
pods
:=
make
(
map
[
types
.
UID
]
*
kubecontainer
.
Pod
)
var
podIDs
[]
types
.
UID
for
_
,
pod
:=
range
listResp
.
Pods
{
for
_
,
pod
:=
range
listResp
.
Pods
{
pod
,
err
:=
r
.
convertRktPod
(
pod
)
pod
,
err
:=
r
.
convertRktPod
(
pod
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -1009,16 +1010,17 @@ func (r *Runtime) GetPods(all bool) ([]*kubecontainer.Pod, error) {
...
@@ -1009,16 +1010,17 @@ func (r *Runtime) GetPods(all bool) ([]*kubecontainer.Pod, error) {
oldPod
,
found
:=
pods
[
pod
.
ID
]
oldPod
,
found
:=
pods
[
pod
.
ID
]
if
!
found
{
if
!
found
{
pods
[
pod
.
ID
]
=
pod
pods
[
pod
.
ID
]
=
pod
podIDs
=
append
(
podIDs
,
pod
.
ID
)
continue
continue
}
}
oldPod
.
Containers
=
append
(
oldPod
.
Containers
,
pod
.
Containers
...
)
oldPod
.
Containers
=
append
(
oldPod
.
Containers
,
pod
.
Containers
...
)
}
}
// Convert map to list.
// Convert map to list
, using the consistent order from the podIDs array
.
var
result
[]
*
kubecontainer
.
Pod
var
result
[]
*
kubecontainer
.
Pod
for
_
,
p
:=
range
pod
s
{
for
_
,
id
:=
range
podID
s
{
result
=
append
(
result
,
p
)
result
=
append
(
result
,
p
ods
[
id
]
)
}
}
return
result
,
nil
return
result
,
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