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
928971ce
Commit
928971ce
authored
Jun 12, 2015
by
Abhi Shah
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9710 from mesosphere/public-get-phase
export kubelet.GetPhase
parents
f39f2f04
3cf7739b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
kubelet.go
pkg/kubelet/kubelet.go
+5
-3
kubelet_test.go
pkg/kubelet/kubelet_test.go
+3
-3
No files found.
pkg/kubelet/kubelet.go
View file @
928971ce
...
...
@@ -1991,8 +1991,10 @@ func (kl *Kubelet) tryUpdateNodeStatus() error {
return
err
}
// getPhase returns the phase of a pod given its container info.
func
getPhase
(
spec
*
api
.
PodSpec
,
info
[]
api
.
ContainerStatus
)
api
.
PodPhase
{
// GetPhase returns the phase of a pod given its container info.
// This func is exported to simplify integration with 3rd party kubelet
// integrations like kubernetes-mesos.
func
GetPhase
(
spec
*
api
.
PodSpec
,
info
[]
api
.
ContainerStatus
)
api
.
PodPhase
{
running
:=
0
waiting
:=
0
stopped
:=
0
...
...
@@ -2111,7 +2113,7 @@ func (kl *Kubelet) generatePodStatus(pod *api.Pod) (api.PodStatus, error) {
}
// Assume info is ready to process
podStatus
.
Phase
=
g
etPhase
(
spec
,
podStatus
.
ContainerStatuses
)
podStatus
.
Phase
=
G
etPhase
(
spec
,
podStatus
.
ContainerStatuses
)
for
_
,
c
:=
range
spec
.
Containers
{
for
i
,
st
:=
range
podStatus
.
ContainerStatuses
{
if
st
.
Name
==
c
.
Name
{
...
...
pkg/kubelet/kubelet_test.go
View file @
928971ce
...
...
@@ -1656,7 +1656,7 @@ func TestPodPhaseWithRestartAlways(t *testing.T) {
},
}
for
_
,
test
:=
range
tests
{
if
status
:=
g
etPhase
(
&
test
.
pod
.
Spec
,
test
.
pod
.
Status
.
ContainerStatuses
);
status
!=
test
.
status
{
if
status
:=
G
etPhase
(
&
test
.
pod
.
Spec
,
test
.
pod
.
Status
.
ContainerStatuses
);
status
!=
test
.
status
{
t
.
Errorf
(
"In test %s, expected %v, got %v"
,
test
.
test
,
test
.
status
,
status
)
}
}
...
...
@@ -1744,7 +1744,7 @@ func TestPodPhaseWithRestartNever(t *testing.T) {
},
}
for
_
,
test
:=
range
tests
{
if
status
:=
g
etPhase
(
&
test
.
pod
.
Spec
,
test
.
pod
.
Status
.
ContainerStatuses
);
status
!=
test
.
status
{
if
status
:=
G
etPhase
(
&
test
.
pod
.
Spec
,
test
.
pod
.
Status
.
ContainerStatuses
);
status
!=
test
.
status
{
t
.
Errorf
(
"In test %s, expected %v, got %v"
,
test
.
test
,
test
.
status
,
status
)
}
}
...
...
@@ -1832,7 +1832,7 @@ func TestPodPhaseWithRestartOnFailure(t *testing.T) {
},
}
for
_
,
test
:=
range
tests
{
if
status
:=
g
etPhase
(
&
test
.
pod
.
Spec
,
test
.
pod
.
Status
.
ContainerStatuses
);
status
!=
test
.
status
{
if
status
:=
G
etPhase
(
&
test
.
pod
.
Spec
,
test
.
pod
.
Status
.
ContainerStatuses
);
status
!=
test
.
status
{
t
.
Errorf
(
"In test %s, expected %v, got %v"
,
test
.
test
,
test
.
status
,
status
)
}
}
...
...
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