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
5e8490d5
Commit
5e8490d5
authored
Dec 18, 2014
by
Brendan Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a PodUnknown phase and make ListPods return even when there are errors
obtaining info for some pods.
parent
5bd560de
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
24 additions
and
6 deletions
+24
-6
latest_test.go
pkg/api/latest/latest_test.go
+1
-1
serialization_test.go
pkg/api/serialization_test.go
+1
-1
types.go
pkg/api/types.go
+3
-0
conversion.go
pkg/api/v1beta1/conversion.go
+4
-0
types.go
pkg/api/v1beta1/types.go
+2
-0
conversion.go
pkg/api/v1beta2/conversion.go
+4
-0
types.go
pkg/api/v1beta2/types.go
+2
-0
types.go
pkg/api/v1beta3/types.go
+3
-0
schema_test.go
pkg/api/validation/schema_test.go
+1
-1
rest.go
pkg/registry/pod/rest.go
+3
-3
No files found.
pkg/api/latest/latest_test.go
View file @
5e8490d5
...
@@ -65,7 +65,7 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
...
@@ -65,7 +65,7 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
j
.
FieldPath
=
c
.
RandString
()
j
.
FieldPath
=
c
.
RandString
()
},
},
func
(
j
*
internal
.
PodPhase
,
c
fuzz
.
Continue
)
{
func
(
j
*
internal
.
PodPhase
,
c
fuzz
.
Continue
)
{
statuses
:=
[]
internal
.
PodPhase
{
internal
.
PodPending
,
internal
.
PodRunning
,
internal
.
PodFailed
}
statuses
:=
[]
internal
.
PodPhase
{
internal
.
PodPending
,
internal
.
PodRunning
,
internal
.
PodFailed
,
internal
.
PodUnknown
}
*
j
=
statuses
[
c
.
Rand
.
Intn
(
len
(
statuses
))]
*
j
=
statuses
[
c
.
Rand
.
Intn
(
len
(
statuses
))]
},
},
func
(
j
*
internal
.
ReplicationControllerSpec
,
c
fuzz
.
Continue
)
{
func
(
j
*
internal
.
ReplicationControllerSpec
,
c
fuzz
.
Continue
)
{
...
...
pkg/api/serialization_test.go
View file @
5e8490d5
...
@@ -69,7 +69,7 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
...
@@ -69,7 +69,7 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
j
.
SelfLink
=
c
.
RandString
()
j
.
SelfLink
=
c
.
RandString
()
},
},
func
(
j
*
api
.
PodPhase
,
c
fuzz
.
Continue
)
{
func
(
j
*
api
.
PodPhase
,
c
fuzz
.
Continue
)
{
statuses
:=
[]
api
.
PodPhase
{
api
.
PodPending
,
api
.
PodRunning
,
api
.
PodFailed
}
statuses
:=
[]
api
.
PodPhase
{
api
.
PodPending
,
api
.
PodRunning
,
api
.
PodFailed
,
api
.
PodUnknown
}
*
j
=
statuses
[
c
.
Rand
.
Intn
(
len
(
statuses
))]
*
j
=
statuses
[
c
.
Rand
.
Intn
(
len
(
statuses
))]
},
},
func
(
j
*
api
.
ReplicationControllerSpec
,
c
fuzz
.
Continue
)
{
func
(
j
*
api
.
ReplicationControllerSpec
,
c
fuzz
.
Continue
)
{
...
...
pkg/api/types.go
View file @
5e8490d5
...
@@ -365,6 +365,9 @@ const (
...
@@ -365,6 +365,9 @@ const (
// PodFailed means that all containers in the pod have terminated, and at least one container has
// PodFailed means that all containers in the pod have terminated, and at least one container has
// terminated in a failure (exited with a non-zero exit code or was stopped by the system).
// terminated in a failure (exited with a non-zero exit code or was stopped by the system).
PodFailed
PodPhase
=
"Failed"
PodFailed
PodPhase
=
"Failed"
// PodUnknown means that for some reason the state of the pod could not be obtained, typically due
// to an error in communicating with the host of the pod.
PodUnknown
PodPhase
=
"Unknown"
)
)
type
ContainerStateWaiting
struct
{
type
ContainerStateWaiting
struct
{
...
...
pkg/api/v1beta1/conversion.go
View file @
5e8490d5
...
@@ -226,6 +226,8 @@ func init() {
...
@@ -226,6 +226,8 @@ func init() {
*
out
=
PodTerminated
*
out
=
PodTerminated
case
newer
.
PodFailed
:
case
newer
.
PodFailed
:
*
out
=
PodTerminated
*
out
=
PodTerminated
case
newer
.
PodUnknown
:
*
out
=
PodUnknown
default
:
default
:
return
errors
.
New
(
"The string provided is not a valid PodPhase constant value"
)
return
errors
.
New
(
"The string provided is not a valid PodPhase constant value"
)
}
}
...
@@ -244,6 +246,8 @@ func init() {
...
@@ -244,6 +246,8 @@ func init() {
case
PodTerminated
:
case
PodTerminated
:
// Older API versions did not contain enough info to map to PodSucceeded
// Older API versions did not contain enough info to map to PodSucceeded
*
out
=
newer
.
PodFailed
*
out
=
newer
.
PodFailed
case
PodUnknown
:
*
out
=
newer
.
PodUnknown
default
:
default
:
return
errors
.
New
(
"The string provided is not a valid PodPhase constant value"
)
return
errors
.
New
(
"The string provided is not a valid PodPhase constant value"
)
}
}
...
...
pkg/api/v1beta1/types.go
View file @
5e8490d5
...
@@ -319,6 +319,8 @@ const (
...
@@ -319,6 +319,8 @@ const (
PodRunning
PodStatus
=
"Running"
PodRunning
PodStatus
=
"Running"
// PodTerminated means that the pod has stopped.
// PodTerminated means that the pod has stopped.
PodTerminated
PodStatus
=
"Terminated"
PodTerminated
PodStatus
=
"Terminated"
// PodUnknown means that we failed to obtain info about the pod.
PodUnknown
PodStatus
=
"Unknown"
)
)
type
ContainerStateWaiting
struct
{
type
ContainerStateWaiting
struct
{
...
...
pkg/api/v1beta2/conversion.go
View file @
5e8490d5
...
@@ -116,6 +116,8 @@ func init() {
...
@@ -116,6 +116,8 @@ func init() {
*
out
=
PodTerminated
*
out
=
PodTerminated
case
newer
.
PodFailed
:
case
newer
.
PodFailed
:
*
out
=
PodTerminated
*
out
=
PodTerminated
case
newer
.
PodUnknown
:
*
out
=
PodUnknown
default
:
default
:
return
errors
.
New
(
"The string provided is not a valid PodPhase constant value"
)
return
errors
.
New
(
"The string provided is not a valid PodPhase constant value"
)
}
}
...
@@ -134,6 +136,8 @@ func init() {
...
@@ -134,6 +136,8 @@ func init() {
case
PodTerminated
:
case
PodTerminated
:
// Older API versions did not contain enough info to map to PodSucceeded
// Older API versions did not contain enough info to map to PodSucceeded
*
out
=
newer
.
PodFailed
*
out
=
newer
.
PodFailed
case
PodUnknown
:
*
out
=
newer
.
PodUnknown
default
:
default
:
return
errors
.
New
(
"The string provided is not a valid PodPhase constant value"
)
return
errors
.
New
(
"The string provided is not a valid PodPhase constant value"
)
}
}
...
...
pkg/api/v1beta2/types.go
View file @
5e8490d5
...
@@ -284,6 +284,8 @@ const (
...
@@ -284,6 +284,8 @@ const (
PodRunning
PodStatus
=
"Running"
PodRunning
PodStatus
=
"Running"
// PodTerminated means that the pod has stopped.
// PodTerminated means that the pod has stopped.
PodTerminated
PodStatus
=
"Terminated"
PodTerminated
PodStatus
=
"Terminated"
// PodUnknown means that we failed to obtain info about the pod.
PodUnknown
PodStatus
=
"Unknown"
)
)
type
ContainerStateWaiting
struct
{
type
ContainerStateWaiting
struct
{
...
...
pkg/api/v1beta3/types.go
View file @
5e8490d5
...
@@ -381,6 +381,9 @@ const (
...
@@ -381,6 +381,9 @@ const (
// PodFailed means that all containers in the pod have terminated, and at least one container has
// PodFailed means that all containers in the pod have terminated, and at least one container has
// terminated in a failure (exited with a non-zero exit code or was stopped by the system).
// terminated in a failure (exited with a non-zero exit code or was stopped by the system).
PodFailed
PodPhase
=
"Failed"
PodFailed
PodPhase
=
"Failed"
// PodUnknown means that for some reason the state of the pod could not be obtained, typically due
// to an error in communicating with the host of the pod.
PodUnknown
PodPhase
=
"Unknown"
)
)
type
ContainerStateWaiting
struct
{
type
ContainerStateWaiting
struct
{
...
...
pkg/api/validation/schema_test.go
View file @
5e8490d5
...
@@ -71,7 +71,7 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
...
@@ -71,7 +71,7 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
j
.
SelfLink
=
c
.
RandString
()
j
.
SelfLink
=
c
.
RandString
()
},
},
func
(
j
*
api
.
PodPhase
,
c
fuzz
.
Continue
)
{
func
(
j
*
api
.
PodPhase
,
c
fuzz
.
Continue
)
{
statuses
:=
[]
api
.
PodPhase
{
api
.
PodPending
,
api
.
PodRunning
,
api
.
PodFailed
}
statuses
:=
[]
api
.
PodPhase
{
api
.
PodPending
,
api
.
PodRunning
,
api
.
PodFailed
,
api
.
PodUnknown
}
*
j
=
statuses
[
c
.
Rand
.
Intn
(
len
(
statuses
))]
*
j
=
statuses
[
c
.
Rand
.
Intn
(
len
(
statuses
))]
},
},
func
(
j
*
api
.
ReplicationControllerSpec
,
c
fuzz
.
Continue
)
{
func
(
j
*
api
.
ReplicationControllerSpec
,
c
fuzz
.
Continue
)
{
...
...
pkg/registry/pod/rest.go
View file @
5e8490d5
...
@@ -171,7 +171,7 @@ func (rs *REST) List(ctx api.Context, label, field labels.Selector) (runtime.Obj
...
@@ -171,7 +171,7 @@ func (rs *REST) List(ctx api.Context, label, field labels.Selector) (runtime.Obj
rs
.
fillPodInfo
(
pod
)
rs
.
fillPodInfo
(
pod
)
status
,
err
:=
getPodStatus
(
pod
,
rs
.
nodes
)
status
,
err
:=
getPodStatus
(
pod
,
rs
.
nodes
)
if
err
!=
nil
{
if
err
!=
nil
{
return
pod
,
err
status
=
api
.
PodUnknown
}
}
pod
.
Status
.
Phase
=
status
pod
.
Status
.
Phase
=
status
if
pod
.
Status
.
Host
!=
""
{
if
pod
.
Status
.
Host
!=
""
{
...
@@ -285,8 +285,8 @@ func getPodStatus(pod *api.Pod, nodes client.NodeInterface) (api.PodPhase, error
...
@@ -285,8 +285,8 @@ func getPodStatus(pod *api.Pod, nodes client.NodeInterface) (api.PodPhase, error
if
errors
.
IsNotFound
(
err
)
{
if
errors
.
IsNotFound
(
err
)
{
return
api
.
PodFailed
,
nil
return
api
.
PodFailed
,
nil
}
}
glog
.
Errorf
(
"Error
listing minions
: %v"
,
err
)
glog
.
Errorf
(
"Error
getting pod info
: %v"
,
err
)
return
""
,
err
return
api
.
PodUnknown
,
nil
}
}
}
else
{
}
else
{
glog
.
Errorf
(
"Unexpected missing minion interface, status may be in-accurate"
)
glog
.
Errorf
(
"Unexpected missing minion interface, status may be in-accurate"
)
...
...
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