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
8159c8fd
Commit
8159c8fd
authored
Nov 21, 2014
by
markturansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor PodCondition to PodPhase
parent
9f5ebef3
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
57 additions
and
57 deletions
+57
-57
e2e.go
cmd/e2e/e2e.go
+2
-2
latest_test.go
pkg/api/latest/latest_test.go
+2
-2
serialization_test.go
pkg/api/serialization_test.go
+2
-2
types.go
pkg/api/types.go
+8
-8
conversion.go
pkg/api/v1beta1/conversion.go
+7
-7
conversion.go
pkg/api/v1beta2/conversion.go
+7
-7
types.go
pkg/api/v1beta3/types.go
+7
-7
schema_test.go
pkg/api/validation/schema_test.go
+2
-2
client_test.go
pkg/client/client_test.go
+5
-5
replication_controller.go
pkg/controller/replication_controller.go
+2
-2
resource_printer.go
pkg/kubecfg/resource_printer.go
+1
-1
describe.go
pkg/kubectl/describe.go
+2
-2
resource_printer.go
pkg/kubectl/resource_printer.go
+1
-1
etcd.go
pkg/registry/etcd/etcd.go
+1
-1
rest.go
pkg/registry/pod/rest.go
+5
-5
rest_test.go
pkg/registry/pod/rest_test.go
+3
-3
No files found.
cmd/e2e/e2e.go
View file @
8159c8fd
...
@@ -46,10 +46,10 @@ func waitForPodRunning(c *client.Client, id string) {
...
@@ -46,10 +46,10 @@ func waitForPodRunning(c *client.Client, id string) {
glog
.
Warningf
(
"Get pod failed: %v"
,
err
)
glog
.
Warningf
(
"Get pod failed: %v"
,
err
)
continue
continue
}
}
if
pod
.
Status
.
Condition
==
api
.
PodRunning
{
if
pod
.
Status
.
Phase
==
api
.
PodRunning
{
break
break
}
}
glog
.
Infof
(
"Waiting for pod status to be running (%s)"
,
pod
.
Status
.
Condition
)
glog
.
Infof
(
"Waiting for pod status to be running (%s)"
,
pod
.
Status
.
Phase
)
}
}
}
}
...
...
pkg/api/latest/latest_test.go
View file @
8159c8fd
...
@@ -71,8 +71,8 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
...
@@ -71,8 +71,8 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
j
.
ResourceVersion
=
strconv
.
FormatUint
(
c
.
RandUint64
()
>>
8
,
10
)
j
.
ResourceVersion
=
strconv
.
FormatUint
(
c
.
RandUint64
()
>>
8
,
10
)
j
.
FieldPath
=
c
.
RandString
()
j
.
FieldPath
=
c
.
RandString
()
},
},
func
(
j
*
internal
.
Pod
Condition
,
c
fuzz
.
Continue
)
{
func
(
j
*
internal
.
Pod
Phase
,
c
fuzz
.
Continue
)
{
statuses
:=
[]
internal
.
Pod
Condition
{
internal
.
PodPending
,
internal
.
PodRunning
,
internal
.
PodFailed
}
statuses
:=
[]
internal
.
Pod
Phase
{
internal
.
PodPending
,
internal
.
PodRunning
,
internal
.
PodFailed
}
*
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 @
8159c8fd
...
@@ -86,8 +86,8 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
...
@@ -86,8 +86,8 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
j
.
ResourceVersion
=
strconv
.
FormatUint
(
c
.
RandUint64
()
>>
8
,
10
)
j
.
ResourceVersion
=
strconv
.
FormatUint
(
c
.
RandUint64
()
>>
8
,
10
)
j
.
SelfLink
=
c
.
RandString
()
j
.
SelfLink
=
c
.
RandString
()
},
},
func
(
j
*
api
.
Pod
Condition
,
c
fuzz
.
Continue
)
{
func
(
j
*
api
.
Pod
Phase
,
c
fuzz
.
Continue
)
{
statuses
:=
[]
api
.
Pod
Condition
{
api
.
PodPending
,
api
.
PodRunning
,
api
.
PodFailed
}
statuses
:=
[]
api
.
Pod
Phase
{
api
.
PodPending
,
api
.
PodRunning
,
api
.
PodFailed
}
*
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 @
8159c8fd
...
@@ -337,24 +337,24 @@ type Lifecycle struct {
...
@@ -337,24 +337,24 @@ type Lifecycle struct {
// The below types are used by kube_client and api_server.
// The below types are used by kube_client and api_server.
// Pod
Condition
is a label for the condition of a pod at the current time.
// Pod
Phase
is a label for the condition of a pod at the current time.
type
Pod
Condition
string
type
Pod
Phase
string
// These are the valid statuses of pods.
// These are the valid statuses of pods.
const
(
const
(
// PodPending means the pod has been accepted by the system, but one or more of the containers
// PodPending means the pod has been accepted by the system, but one or more of the containers
// has not been started. This includes time before being bound to a node, as well as time spent
// has not been started. This includes time before being bound to a node, as well as time spent
// pulling images onto the host.
// pulling images onto the host.
PodPending
Pod
Condition
=
"Pending"
PodPending
Pod
Phase
=
"Pending"
// PodRunning means the pod has been bound to a node and all of the containers have been started.
// PodRunning means the pod has been bound to a node and all of the containers have been started.
// At least one container is still running or is in the process of being restarted.
// At least one container is still running or is in the process of being restarted.
PodRunning
Pod
Condition
=
"Running"
PodRunning
Pod
Phase
=
"Running"
// PodSucceeded means that all containers in the pod have voluntarily terminated
// PodSucceeded means that all containers in the pod have voluntarily terminated
// with a container exit code of 0, and the system is not going to restart any of these containers.
// with a container exit code of 0, and the system is not going to restart any of these containers.
PodSucceeded
Pod
Condition
=
"Succeeded"
PodSucceeded
Pod
Phase
=
"Succeeded"
// 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
Pod
Condition
=
"Failed"
PodFailed
Pod
Phase
=
"Failed"
)
)
type
ContainerStateWaiting
struct
{
type
ContainerStateWaiting
struct
{
...
@@ -422,7 +422,7 @@ type RestartPolicy struct {
...
@@ -422,7 +422,7 @@ type RestartPolicy struct {
// PodState is the state of a pod, used as either input (desired state) or output (current state).
// PodState is the state of a pod, used as either input (desired state) or output (current state).
type
PodState
struct
{
type
PodState
struct
{
Manifest
ContainerManifest
`json:"manifest,omitempty" yaml:"manifest,omitempty"`
Manifest
ContainerManifest
`json:"manifest,omitempty" yaml:"manifest,omitempty"`
Status
Pod
Condition
`json:"status,omitempty" yaml:"status,omitempty"`
Status
Pod
Phase
`json:"status,omitempty" yaml:"status,omitempty"`
// A human readable message indicating details about why the pod is in this state.
// A human readable message indicating details about why the pod is in this state.
Message
string
`json:"message,omitempty" yaml:"message,omitempty"`
Message
string
`json:"message,omitempty" yaml:"message,omitempty"`
Host
string
`json:"host,omitempty" yaml:"host,omitempty"`
Host
string
`json:"host,omitempty" yaml:"host,omitempty"`
...
@@ -458,7 +458,7 @@ type PodSpec struct {
...
@@ -458,7 +458,7 @@ type PodSpec struct {
// PodStatus represents information about the status of a pod. Status may trail the actual
// PodStatus represents information about the status of a pod. Status may trail the actual
// state of a system.
// state of a system.
type
PodStatus
struct
{
type
PodStatus
struct
{
Condition
PodCondition
`json:"condition,omitempty" yaml:"condition
,omitempty"`
Phase
PodPhase
`json:"phase,omitempty" yaml:"phase
,omitempty"`
// Host is the name of the node that this Pod is currently bound to, or empty if no
// Host is the name of the node that this Pod is currently bound to, or empty if no
// assignment has been done.
// assignment has been done.
...
...
pkg/api/v1beta1/conversion.go
View file @
8159c8fd
...
@@ -161,7 +161,7 @@ func init() {
...
@@ -161,7 +161,7 @@ func init() {
},
},
func
(
in
*
newer
.
PodStatus
,
out
*
PodState
,
s
conversion
.
Scope
)
error
{
func
(
in
*
newer
.
PodStatus
,
out
*
PodState
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
Convert
(
&
in
.
Condition
,
&
out
.
Status
,
0
);
err
!=
nil
{
if
err
:=
s
.
Convert
(
&
in
.
Phase
,
&
out
.
Status
,
0
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
s
.
Convert
(
&
in
.
Info
,
&
out
.
Info
,
0
);
err
!=
nil
{
if
err
:=
s
.
Convert
(
&
in
.
Info
,
&
out
.
Info
,
0
);
err
!=
nil
{
...
@@ -173,7 +173,7 @@ func init() {
...
@@ -173,7 +173,7 @@ func init() {
return
nil
return
nil
},
},
func
(
in
*
PodState
,
out
*
newer
.
PodStatus
,
s
conversion
.
Scope
)
error
{
func
(
in
*
PodState
,
out
*
newer
.
PodStatus
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
Convert
(
&
in
.
Status
,
&
out
.
Condition
,
0
);
err
!=
nil
{
if
err
:=
s
.
Convert
(
&
in
.
Status
,
&
out
.
Phase
,
0
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
s
.
Convert
(
&
in
.
Info
,
&
out
.
Info
,
0
);
err
!=
nil
{
if
err
:=
s
.
Convert
(
&
in
.
Info
,
&
out
.
Info
,
0
);
err
!=
nil
{
...
@@ -186,8 +186,8 @@ func init() {
...
@@ -186,8 +186,8 @@ func init() {
return
nil
return
nil
},
},
// Convert all to the new Pod
Condition
constants
// Convert all to the new Pod
Phase
constants
func
(
in
*
newer
.
Pod
Condition
,
out
*
PodStatus
,
s
conversion
.
Scope
)
error
{
func
(
in
*
newer
.
Pod
Phase
,
out
*
PodStatus
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
switch
*
in
{
case
""
:
case
""
:
*
out
=
""
*
out
=
""
...
@@ -200,13 +200,13 @@ func init() {
...
@@ -200,13 +200,13 @@ func init() {
case
newer
.
PodFailed
:
case
newer
.
PodFailed
:
*
out
=
PodTerminated
*
out
=
PodTerminated
default
:
default
:
return
errors
.
New
(
"The string provided is not a valid Pod
Condition
constant value"
)
return
errors
.
New
(
"The string provided is not a valid Pod
Phase
constant value"
)
}
}
return
nil
return
nil
},
},
func
(
in
*
PodStatus
,
out
*
newer
.
Pod
Condition
,
s
conversion
.
Scope
)
error
{
func
(
in
*
PodStatus
,
out
*
newer
.
Pod
Phase
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
switch
*
in
{
case
""
:
case
""
:
*
out
=
""
*
out
=
""
...
@@ -218,7 +218,7 @@ func init() {
...
@@ -218,7 +218,7 @@ func init() {
// 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
default
:
default
:
return
errors
.
New
(
"The string provided is not a valid Pod
Condition
constant value"
)
return
errors
.
New
(
"The string provided is not a valid Pod
Phase
constant value"
)
}
}
return
nil
return
nil
},
},
...
...
pkg/api/v1beta2/conversion.go
View file @
8159c8fd
...
@@ -90,8 +90,8 @@ func init() {
...
@@ -90,8 +90,8 @@ func init() {
return
s
.
Convert
(
&
in
.
Annotations
,
&
out
.
Annotations
,
0
)
return
s
.
Convert
(
&
in
.
Annotations
,
&
out
.
Annotations
,
0
)
},
},
// Convert all to the new Pod
Condition
constants
// Convert all to the new Pod
Phase
constants
func
(
in
*
newer
.
Pod
Condition
,
out
*
PodStatus
,
s
conversion
.
Scope
)
error
{
func
(
in
*
newer
.
Pod
Phase
,
out
*
PodStatus
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
switch
*
in
{
case
""
:
case
""
:
*
out
=
""
*
out
=
""
...
@@ -104,13 +104,13 @@ func init() {
...
@@ -104,13 +104,13 @@ func init() {
case
newer
.
PodFailed
:
case
newer
.
PodFailed
:
*
out
=
PodTerminated
*
out
=
PodTerminated
default
:
default
:
return
errors
.
New
(
"The string provided is not a valid Pod
Condition
constant value"
)
return
errors
.
New
(
"The string provided is not a valid Pod
Phase
constant value"
)
}
}
return
nil
return
nil
},
},
func
(
in
*
PodStatus
,
out
*
newer
.
Pod
Condition
,
s
conversion
.
Scope
)
error
{
func
(
in
*
PodStatus
,
out
*
newer
.
Pod
Phase
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
switch
*
in
{
case
""
:
case
""
:
*
out
=
""
*
out
=
""
...
@@ -122,7 +122,7 @@ func init() {
...
@@ -122,7 +122,7 @@ func init() {
// 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
default
:
default
:
return
errors
.
New
(
"The string provided is not a valid Pod
Condition
constant value"
)
return
errors
.
New
(
"The string provided is not a valid Pod
Phase
constant value"
)
}
}
return
nil
return
nil
},
},
...
@@ -279,7 +279,7 @@ func init() {
...
@@ -279,7 +279,7 @@ func init() {
},
},
func
(
in
*
newer
.
PodStatus
,
out
*
PodState
,
s
conversion
.
Scope
)
error
{
func
(
in
*
newer
.
PodStatus
,
out
*
PodState
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
Convert
(
&
in
.
Condition
,
&
out
.
Status
,
0
);
err
!=
nil
{
if
err
:=
s
.
Convert
(
&
in
.
Phase
,
&
out
.
Status
,
0
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
s
.
Convert
(
&
in
.
Info
,
&
out
.
Info
,
0
);
err
!=
nil
{
if
err
:=
s
.
Convert
(
&
in
.
Info
,
&
out
.
Info
,
0
);
err
!=
nil
{
...
@@ -291,7 +291,7 @@ func init() {
...
@@ -291,7 +291,7 @@ func init() {
return
nil
return
nil
},
},
func
(
in
*
PodState
,
out
*
newer
.
PodStatus
,
s
conversion
.
Scope
)
error
{
func
(
in
*
PodState
,
out
*
newer
.
PodStatus
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
Convert
(
&
in
.
Status
,
&
out
.
Condition
,
0
);
err
!=
nil
{
if
err
:=
s
.
Convert
(
&
in
.
Status
,
&
out
.
Phase
,
0
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
s
.
Convert
(
&
in
.
Info
,
&
out
.
Info
,
0
);
err
!=
nil
{
if
err
:=
s
.
Convert
(
&
in
.
Info
,
&
out
.
Info
,
0
);
err
!=
nil
{
...
...
pkg/api/v1beta3/types.go
View file @
8159c8fd
...
@@ -366,24 +366,24 @@ type Lifecycle struct {
...
@@ -366,24 +366,24 @@ type Lifecycle struct {
PreStop
*
Handler
`json:"preStop,omitempty" yaml:"preStop,omitempty"`
PreStop
*
Handler
`json:"preStop,omitempty" yaml:"preStop,omitempty"`
}
}
// Pod
Condition
is a label for the condition of a pod at the current time.
// Pod
Phase
is a label for the condition of a pod at the current time.
type
Pod
Condition
string
type
Pod
Phase
string
// These are the valid states of pods.
// These are the valid states of pods.
const
(
const
(
// PodPending means the pod has been accepted by the system, but one or more of the containers
// PodPending means the pod has been accepted by the system, but one or more of the containers
// has not been started. This includes time before being bound to a node, as well as time spent
// has not been started. This includes time before being bound to a node, as well as time spent
// pulling images onto the host.
// pulling images onto the host.
PodPending
Pod
Condition
=
"Pending"
PodPending
Pod
Phase
=
"Pending"
// PodRunning means the pod has been bound to a node and all of the containers have been started.
// PodRunning means the pod has been bound to a node and all of the containers have been started.
// At least one container is still running or is in the process of being restarted.
// At least one container is still running or is in the process of being restarted.
PodRunning
Pod
Condition
=
"Running"
PodRunning
Pod
Phase
=
"Running"
// PodSucceeded means that all containers in the pod have voluntarily terminated
// PodSucceeded means that all containers in the pod have voluntarily terminated
// with a container exit code of 0, and the system is not going to restart any of these containers.
// with a container exit code of 0, and the system is not going to restart any of these containers.
PodSucceeded
Pod
Condition
=
"Succeeded"
PodSucceeded
Pod
Phase
=
"Succeeded"
// 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
Pod
Condition
=
"Failed"
PodFailed
Pod
Phase
=
"Failed"
)
)
type
ContainerStateWaiting
struct
{
type
ContainerStateWaiting
struct
{
...
@@ -456,7 +456,7 @@ type PodSpec struct {
...
@@ -456,7 +456,7 @@ type PodSpec struct {
// PodStatus represents information about the status of a pod. Status may trail the actual
// PodStatus represents information about the status of a pod. Status may trail the actual
// state of a system.
// state of a system.
type
PodStatus
struct
{
type
PodStatus
struct
{
Condition
PodCondition
`json:"condition,omitempty" yaml:"condition
,omitempty"`
Phase
PodPhase
`json:"phase,omitempty" yaml:"phase
,omitempty"`
// A human readable message indicating details about why the pod is in this state.
// A human readable message indicating details about why the pod is in this state.
Message
string
`json:"message,omitempty" yaml:"message,omitempty"`
Message
string
`json:"message,omitempty" yaml:"message,omitempty"`
...
...
pkg/api/validation/schema_test.go
View file @
8159c8fd
...
@@ -88,8 +88,8 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
...
@@ -88,8 +88,8 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
j
.
ResourceVersion
=
strconv
.
FormatUint
(
c
.
RandUint64
()
>>
8
,
10
)
j
.
ResourceVersion
=
strconv
.
FormatUint
(
c
.
RandUint64
()
>>
8
,
10
)
j
.
SelfLink
=
c
.
RandString
()
j
.
SelfLink
=
c
.
RandString
()
},
},
func
(
j
*
api
.
Pod
Condition
,
c
fuzz
.
Continue
)
{
func
(
j
*
api
.
Pod
Phase
,
c
fuzz
.
Continue
)
{
statuses
:=
[]
api
.
Pod
Condition
{
api
.
PodPending
,
api
.
PodRunning
,
api
.
PodFailed
}
statuses
:=
[]
api
.
Pod
Phase
{
api
.
PodPending
,
api
.
PodRunning
,
api
.
PodFailed
}
*
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/client/client_test.go
View file @
8159c8fd
...
@@ -173,7 +173,7 @@ func TestListPods(t *testing.T) {
...
@@ -173,7 +173,7 @@ func TestListPods(t *testing.T) {
Items
:
[]
api
.
Pod
{
Items
:
[]
api
.
Pod
{
{
{
Status
:
api
.
PodStatus
{
Status
:
api
.
PodStatus
{
Condition
:
api
.
PodRunning
,
Phase
:
api
.
PodRunning
,
},
},
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
...
@@ -206,7 +206,7 @@ func TestListPodsLabels(t *testing.T) {
...
@@ -206,7 +206,7 @@ func TestListPodsLabels(t *testing.T) {
Items
:
[]
api
.
Pod
{
Items
:
[]
api
.
Pod
{
{
{
Status
:
api
.
PodStatus
{
Status
:
api
.
PodStatus
{
Condition
:
api
.
PodRunning
,
Phase
:
api
.
PodRunning
,
},
},
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
...
@@ -234,7 +234,7 @@ func TestGetPod(t *testing.T) {
...
@@ -234,7 +234,7 @@ func TestGetPod(t *testing.T) {
StatusCode
:
200
,
StatusCode
:
200
,
Body
:
&
api
.
Pod
{
Body
:
&
api
.
Pod
{
Status
:
api
.
PodStatus
{
Status
:
api
.
PodStatus
{
Condition
:
api
.
PodRunning
,
Phase
:
api
.
PodRunning
,
},
},
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
...
@@ -261,7 +261,7 @@ func TestDeletePod(t *testing.T) {
...
@@ -261,7 +261,7 @@ func TestDeletePod(t *testing.T) {
func
TestCreatePod
(
t
*
testing
.
T
)
{
func
TestCreatePod
(
t
*
testing
.
T
)
{
requestPod
:=
&
api
.
Pod
{
requestPod
:=
&
api
.
Pod
{
Status
:
api
.
PodStatus
{
Status
:
api
.
PodStatus
{
Condition
:
api
.
PodRunning
,
Phase
:
api
.
PodRunning
,
},
},
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
...
@@ -292,7 +292,7 @@ func TestUpdatePod(t *testing.T) {
...
@@ -292,7 +292,7 @@ func TestUpdatePod(t *testing.T) {
},
},
},
},
Status
:
api
.
PodStatus
{
Status
:
api
.
PodStatus
{
Condition
:
api
.
PodRunning
,
Phase
:
api
.
PodRunning
,
},
},
}
}
c
:=
&
testClient
{
c
:=
&
testClient
{
...
...
pkg/controller/replication_controller.go
View file @
8159c8fd
...
@@ -143,8 +143,8 @@ func (rm *ReplicationManager) watchControllers(resourceVersion *string) {
...
@@ -143,8 +143,8 @@ func (rm *ReplicationManager) watchControllers(resourceVersion *string) {
func
(
rm
*
ReplicationManager
)
filterActivePods
(
pods
[]
api
.
Pod
)
[]
api
.
Pod
{
func
(
rm
*
ReplicationManager
)
filterActivePods
(
pods
[]
api
.
Pod
)
[]
api
.
Pod
{
var
result
[]
api
.
Pod
var
result
[]
api
.
Pod
for
_
,
value
:=
range
pods
{
for
_
,
value
:=
range
pods
{
if
api
.
PodSucceeded
!=
value
.
Status
.
Condition
&&
if
api
.
PodSucceeded
!=
value
.
Status
.
Phase
&&
api
.
PodFailed
!=
value
.
Status
.
Condition
{
api
.
PodFailed
!=
value
.
Status
.
Phase
{
result
=
append
(
result
,
value
)
result
=
append
(
result
,
value
)
}
}
}
}
...
...
pkg/kubecfg/resource_printer.go
View file @
8159c8fd
...
@@ -204,7 +204,7 @@ func printPod(pod *api.Pod, w io.Writer) error {
...
@@ -204,7 +204,7 @@ func printPod(pod *api.Pod, w io.Writer) error {
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\t
%s
\t
%s
\t
%s
\n
"
,
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\t
%s
\t
%s
\t
%s
\n
"
,
pod
.
Name
,
makeImageList
(
pod
.
Spec
),
pod
.
Name
,
makeImageList
(
pod
.
Spec
),
podHostString
(
pod
.
Status
.
Host
,
pod
.
Status
.
HostIP
),
podHostString
(
pod
.
Status
.
Host
,
pod
.
Status
.
HostIP
),
labels
.
Set
(
pod
.
Labels
),
pod
.
Status
.
Condition
)
labels
.
Set
(
pod
.
Labels
),
pod
.
Status
.
Phase
)
return
err
return
err
}
}
...
...
pkg/kubectl/describe.go
View file @
8159c8fd
...
@@ -93,7 +93,7 @@ func (d *PodDescriber) Describe(namespace, name string) (string, error) {
...
@@ -93,7 +93,7 @@ func (d *PodDescriber) Describe(namespace, name string) (string, error) {
fmt
.
Fprintf
(
out
,
"Image(s):
\t
%s
\n
"
,
makeImageList
(
spec
))
fmt
.
Fprintf
(
out
,
"Image(s):
\t
%s
\n
"
,
makeImageList
(
spec
))
fmt
.
Fprintf
(
out
,
"Host:
\t
%s
\n
"
,
pod
.
Status
.
Host
+
"/"
+
pod
.
Status
.
HostIP
)
fmt
.
Fprintf
(
out
,
"Host:
\t
%s
\n
"
,
pod
.
Status
.
Host
+
"/"
+
pod
.
Status
.
HostIP
)
fmt
.
Fprintf
(
out
,
"Labels:
\t
%s
\n
"
,
formatLabels
(
pod
.
Labels
))
fmt
.
Fprintf
(
out
,
"Labels:
\t
%s
\n
"
,
formatLabels
(
pod
.
Labels
))
fmt
.
Fprintf
(
out
,
"Status:
\t
%s
\n
"
,
string
(
pod
.
Status
.
Condition
))
fmt
.
Fprintf
(
out
,
"Status:
\t
%s
\n
"
,
string
(
pod
.
Status
.
Phase
))
fmt
.
Fprintf
(
out
,
"Replication Controllers:
\t
%s
\n
"
,
getReplicationControllersForLabels
(
rc
,
labels
.
Set
(
pod
.
Labels
)))
fmt
.
Fprintf
(
out
,
"Replication Controllers:
\t
%s
\n
"
,
getReplicationControllersForLabels
(
rc
,
labels
.
Set
(
pod
.
Labels
)))
if
events
!=
nil
{
if
events
!=
nil
{
describeEvents
(
events
,
out
)
describeEvents
(
events
,
out
)
...
@@ -247,7 +247,7 @@ func getPodStatusForReplicationController(c client.PodInterface, controller *api
...
@@ -247,7 +247,7 @@ func getPodStatusForReplicationController(c client.PodInterface, controller *api
return
return
}
}
for
_
,
pod
:=
range
rcPods
.
Items
{
for
_
,
pod
:=
range
rcPods
.
Items
{
switch
pod
.
Status
.
Condition
{
switch
pod
.
Status
.
Phase
{
case
api
.
PodRunning
:
case
api
.
PodRunning
:
running
++
running
++
case
api
.
PodPending
:
case
api
.
PodPending
:
...
...
pkg/kubectl/resource_printer.go
View file @
8159c8fd
...
@@ -243,7 +243,7 @@ func printPod(pod *api.Pod, w io.Writer) error {
...
@@ -243,7 +243,7 @@ func printPod(pod *api.Pod, w io.Writer) error {
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\t
%s
\t
%s
\t
%s
\n
"
,
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\t
%s
\t
%s
\t
%s
\n
"
,
pod
.
Name
,
firstImage
,
pod
.
Name
,
firstImage
,
podHostString
(
pod
.
Status
.
Host
,
pod
.
Status
.
HostIP
),
podHostString
(
pod
.
Status
.
Host
,
pod
.
Status
.
HostIP
),
labels
.
Set
(
pod
.
Labels
),
pod
.
Status
.
Condition
)
labels
.
Set
(
pod
.
Labels
),
pod
.
Status
.
Phase
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
pkg/registry/etcd/etcd.go
View file @
8159c8fd
...
@@ -159,7 +159,7 @@ func makeContainerKey(machine string) string {
...
@@ -159,7 +159,7 @@ func makeContainerKey(machine string) string {
// CreatePod creates a pod based on a specification.
// CreatePod creates a pod based on a specification.
func
(
r
*
Registry
)
CreatePod
(
ctx
api
.
Context
,
pod
*
api
.
Pod
)
error
{
func
(
r
*
Registry
)
CreatePod
(
ctx
api
.
Context
,
pod
*
api
.
Pod
)
error
{
// Set current status to "Waiting".
// Set current status to "Waiting".
pod
.
Status
.
Condition
=
api
.
PodPending
pod
.
Status
.
Phase
=
api
.
PodPending
pod
.
Status
.
Host
=
""
pod
.
Status
.
Host
=
""
key
,
err
:=
makePodKey
(
ctx
,
pod
.
Name
)
key
,
err
:=
makePodKey
(
ctx
,
pod
.
Name
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/registry/pod/rest.go
View file @
8159c8fd
...
@@ -129,7 +129,7 @@ func (rs *REST) Get(ctx api.Context, id string) (runtime.Object, error) {
...
@@ -129,7 +129,7 @@ func (rs *REST) Get(ctx api.Context, id string) (runtime.Object, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
pod
,
err
return
pod
,
err
}
}
pod
.
Status
.
Condition
=
status
pod
.
Status
.
Phase
=
status
}
}
if
pod
.
Status
.
Host
!=
""
{
if
pod
.
Status
.
Host
!=
""
{
pod
.
Status
.
HostIP
=
rs
.
getInstanceIP
(
pod
.
Status
.
Host
)
pod
.
Status
.
HostIP
=
rs
.
getInstanceIP
(
pod
.
Status
.
Host
)
...
@@ -143,11 +143,11 @@ func (rs *REST) podToSelectableFields(pod *api.Pod) labels.Set {
...
@@ -143,11 +143,11 @@ func (rs *REST) podToSelectableFields(pod *api.Pod) labels.Set {
// see https://github.com/GoogleCloudPlatform/kubernetes/pull/2503
// see https://github.com/GoogleCloudPlatform/kubernetes/pull/2503
var
olderPodStatus
v1beta1
.
PodStatus
var
olderPodStatus
v1beta1
.
PodStatus
api
.
Scheme
.
Convert
(
pod
.
Status
.
Condition
,
&
olderPodStatus
)
api
.
Scheme
.
Convert
(
pod
.
Status
.
Phase
,
&
olderPodStatus
)
return
labels
.
Set
{
return
labels
.
Set
{
"name"
:
pod
.
Name
,
"name"
:
pod
.
Name
,
"Status.
Condition"
:
string
(
pod
.
Status
.
Condition
),
"Status.
Phase"
:
string
(
pod
.
Status
.
Phase
),
"Status.Host"
:
pod
.
Status
.
Host
,
"Status.Host"
:
pod
.
Status
.
Host
,
"DesiredState.Status"
:
string
(
olderPodStatus
),
"DesiredState.Status"
:
string
(
olderPodStatus
),
"DesiredState.Host"
:
pod
.
Status
.
Host
,
"DesiredState.Host"
:
pod
.
Status
.
Host
,
...
@@ -173,7 +173,7 @@ func (rs *REST) List(ctx api.Context, label, field labels.Selector) (runtime.Obj
...
@@ -173,7 +173,7 @@ func (rs *REST) List(ctx api.Context, label, field labels.Selector) (runtime.Obj
if
err
!=
nil
{
if
err
!=
nil
{
return
pod
,
err
return
pod
,
err
}
}
pod
.
Status
.
Condition
=
status
pod
.
Status
.
Phase
=
status
if
pod
.
Status
.
Host
!=
""
{
if
pod
.
Status
.
Host
!=
""
{
pod
.
Status
.
HostIP
=
rs
.
getInstanceIP
(
pod
.
Status
.
Host
)
pod
.
Status
.
HostIP
=
rs
.
getInstanceIP
(
pod
.
Status
.
Host
)
}
}
...
@@ -274,7 +274,7 @@ func getInstanceIPFromCloud(cloud cloudprovider.Interface, host string) string {
...
@@ -274,7 +274,7 @@ func getInstanceIPFromCloud(cloud cloudprovider.Interface, host string) string {
return
addr
.
String
()
return
addr
.
String
()
}
}
func
getPodStatus
(
pod
*
api
.
Pod
,
minions
client
.
MinionInterface
)
(
api
.
Pod
Condition
,
error
)
{
func
getPodStatus
(
pod
*
api
.
Pod
,
minions
client
.
MinionInterface
)
(
api
.
Pod
Phase
,
error
)
{
if
pod
.
Status
.
Host
==
""
{
if
pod
.
Status
.
Host
==
""
{
return
api
.
PodPending
,
nil
return
api
.
PodPending
,
nil
}
}
...
...
pkg/registry/pod/rest_test.go
View file @
8159c8fd
...
@@ -205,7 +205,7 @@ func TestListPodListSelection(t *testing.T) {
...
@@ -205,7 +205,7 @@ func TestListPodListSelection(t *testing.T) {
Status
:
api
.
PodStatus
{
Host
:
"barhost"
},
Status
:
api
.
PodStatus
{
Host
:
"barhost"
},
},
{
},
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"baz"
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"baz"
},
Status
:
api
.
PodStatus
{
Condition
:
"bazstatus"
},
Status
:
api
.
PodStatus
{
Phase
:
"bazstatus"
},
},
{
},
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"qux"
,
Name
:
"qux"
,
...
@@ -236,7 +236,7 @@ func TestListPodListSelection(t *testing.T) {
...
@@ -236,7 +236,7 @@ func TestListPodListSelection(t *testing.T) {
label
:
"label=qux"
,
label
:
"label=qux"
,
expectedIDs
:
util
.
NewStringSet
(
"qux"
),
expectedIDs
:
util
.
NewStringSet
(
"qux"
),
},
{
},
{
field
:
"Status.
Condition
=bazstatus"
,
field
:
"Status.
Phase
=bazstatus"
,
expectedIDs
:
util
.
NewStringSet
(
"baz"
),
expectedIDs
:
util
.
NewStringSet
(
"baz"
),
},
{
},
{
field
:
"Status.Host=barhost"
,
field
:
"Status.Host=barhost"
,
...
@@ -400,7 +400,7 @@ func TestMakePodStatus(t *testing.T) {
...
@@ -400,7 +400,7 @@ func TestMakePodStatus(t *testing.T) {
tests
:=
[]
struct
{
tests
:=
[]
struct
{
pod
*
api
.
Pod
pod
*
api
.
Pod
status
api
.
Pod
Condition
status
api
.
Pod
Phase
test
string
test
string
}{
}{
{
&
api
.
Pod
{
Spec
:
desiredState
,
Status
:
currentState
},
api
.
PodPending
,
"waiting"
},
{
&
api
.
Pod
{
Spec
:
desiredState
,
Status
:
currentState
},
api
.
PodPending
,
"waiting"
},
...
...
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