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
357a9d1f
Commit
357a9d1f
authored
Mar 05, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22033 from yifan-gu/rkt_get_status
Auto commit by PR queue bot
parents
3c5b57b2
168ec8b8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
runtime.go
pkg/kubelet/container/runtime.go
+9
-0
kubelet.go
pkg/kubelet/kubelet.go
+3
-0
rkt.go
pkg/kubelet/rkt/rkt.go
+0
-6
No files found.
pkg/kubelet/container/runtime.go
View file @
357a9d1f
...
@@ -472,3 +472,12 @@ func ParsePodFullName(podFullName string) (string, string, error) {
...
@@ -472,3 +472,12 @@ func ParsePodFullName(podFullName string) (string, string, error) {
// Option is a functional option type for Runtime, useful for
// Option is a functional option type for Runtime, useful for
// completely optional settings.
// completely optional settings.
type
Option
func
(
Runtime
)
type
Option
func
(
Runtime
)
// Sort the container statuses by creation time.
type
SortContainerStatusesByCreationTime
[]
*
ContainerStatus
func
(
s
SortContainerStatusesByCreationTime
)
Len
()
int
{
return
len
(
s
)
}
func
(
s
SortContainerStatusesByCreationTime
)
Swap
(
i
,
j
int
)
{
s
[
i
],
s
[
j
]
=
s
[
j
],
s
[
i
]
}
func
(
s
SortContainerStatusesByCreationTime
)
Less
(
i
,
j
int
)
bool
{
return
s
[
i
]
.
CreatedAt
.
Before
(
s
[
j
]
.
CreatedAt
)
}
pkg/kubelet/kubelet.go
View file @
357a9d1f
...
@@ -3312,6 +3312,9 @@ func (kl *Kubelet) convertStatusToAPIStatus(pod *api.Pod, podStatus *kubecontain
...
@@ -3312,6 +3312,9 @@ func (kl *Kubelet) convertStatusToAPIStatus(pod *api.Pod, podStatus *kubecontain
return
status
return
status
}
}
// Make the latest container status comes first.
sort
.
Sort
(
sort
.
Reverse
(
kubecontainer
.
SortContainerStatusesByCreationTime
(
podStatus
.
ContainerStatuses
)))
statuses
:=
make
(
map
[
string
]
*
api
.
ContainerStatus
,
len
(
pod
.
Spec
.
Containers
))
statuses
:=
make
(
map
[
string
]
*
api
.
ContainerStatus
,
len
(
pod
.
Spec
.
Containers
))
// Create a map of expected containers based on the pod spec.
// Create a map of expected containers based on the pod spec.
expectedContainers
:=
make
(
map
[
string
]
api
.
Container
)
expectedContainers
:=
make
(
map
[
string
]
api
.
Container
)
...
...
pkg/kubelet/rkt/rkt.go
View file @
357a9d1f
...
@@ -1483,9 +1483,3 @@ func (r *Runtime) GetPodStatus(uid types.UID, name, namespace string) (*kubecont
...
@@ -1483,9 +1483,3 @@ func (r *Runtime) GetPodStatus(uid types.UID, name, namespace string) (*kubecont
return
podStatus
,
nil
return
podStatus
,
nil
}
}
type
sortByRestartCount
[]
*
kubecontainer
.
ContainerStatus
func
(
s
sortByRestartCount
)
Len
()
int
{
return
len
(
s
)
}
func
(
s
sortByRestartCount
)
Swap
(
i
,
j
int
)
{
s
[
i
],
s
[
j
]
=
s
[
j
],
s
[
i
]
}
func
(
s
sortByRestartCount
)
Less
(
i
,
j
int
)
bool
{
return
s
[
i
]
.
RestartCount
<
s
[
j
]
.
RestartCount
}
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