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
5267127a
Commit
5267127a
authored
Feb 23, 2015
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api: rename conditionkind -> conditiontype
parent
754a2a83
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
324 additions
and
72 deletions
+324
-72
types.go
pkg/api/types.go
+7
-7
conversion.go
pkg/api/v1beta1/conversion.go
+126
-0
conversion.go
pkg/api/v1beta2/conversion.go
+126
-0
types.go
pkg/api/v1beta3/types.go
+9
-9
nodecontroller.go
pkg/cloudprovider/controller/nodecontroller.go
+6
-6
nodecontroller_test.go
pkg/cloudprovider/controller/nodecontroller_test.go
+11
-11
describe.go
pkg/kubectl/describe.go
+4
-4
resource_printer.go
pkg/kubectl/resource_printer.go
+5
-5
resource_printer_test.go
pkg/kubectl/resource_printer_test.go
+7
-7
kubelet.go
pkg/kubelet/kubelet.go
+2
-2
kubelet_test.go
pkg/kubelet/kubelet_test.go
+2
-2
pod_cache.go
pkg/master/pod_cache.go
+1
-1
pod_cache_test.go
pkg/master/pod_cache_test.go
+2
-2
endpoints_controller.go
pkg/service/endpoints_controller.go
+1
-1
endpoints_controller_test.go
pkg/service/endpoints_controller_test.go
+1
-1
factory.go
plugin/pkg/scheduler/factory/factory.go
+2
-2
factory_test.go
plugin/pkg/scheduler/factory/factory_test.go
+12
-12
No files found.
pkg/api/types.go
View file @
5267127a
...
...
@@ -472,18 +472,18 @@ const (
PodUnknown
PodPhase
=
"Unknown"
)
type
PodCondition
Kind
string
type
PodCondition
Type
string
// These are valid conditions of pod.
const
(
// PodReady means the pod is able to service requests and should be added to the
// load balancing pools of all matching services.
PodReady
PodCondition
Kind
=
"Ready"
PodReady
PodCondition
Type
=
"Ready"
)
// TODO: add LastTransitionTime, Reason, Message to match NodeCondition api.
type
PodCondition
struct
{
Kind
PodConditionKind
`json:"kind
"`
Type
PodConditionType
`json:"type
"`
Status
ConditionStatus
`json:"status"`
}
...
...
@@ -805,20 +805,20 @@ const (
NodeTerminated
NodePhase
=
"Terminated"
)
type
NodeCondition
Kind
string
type
NodeCondition
Type
string
// These are valid conditions of node. Currently, we don't have enough information to decide
// node condition. In the future, we will add more. The proposed set of conditions are:
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.
const
(
// NodeReachable means the node can be reached (in the sense of HTTP connection) from node controller.
NodeReachable
NodeCondition
Kind
=
"Reachable"
NodeReachable
NodeCondition
Type
=
"Reachable"
// NodeReady means the node returns StatusOK for HTTP health check.
NodeReady
NodeCondition
Kind
=
"Ready"
NodeReady
NodeCondition
Type
=
"Ready"
)
type
NodeCondition
struct
{
Kind
NodeConditionKind
`json:"kind
"`
Type
NodeConditionType
`json:"type
"`
Status
ConditionStatus
`json:"status"`
LastProbeTime
util
.
Time
`json:"lastProbeTime,omitempty"`
LastTransitionTime
util
.
Time
`json:"lastTransitionTime,omitempty"`
...
...
pkg/api/v1beta1/conversion.go
View file @
5267127a
...
...
@@ -1158,6 +1158,132 @@ func init() {
}
return
nil
},
func
(
in
*
newer
.
NodeCondition
,
out
*
NodeCondition
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
Convert
(
&
in
.
Type
,
&
out
.
Kind
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Status
,
&
out
.
Status
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
LastProbeTime
,
&
out
.
LastProbeTime
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
LastTransitionTime
,
&
out
.
LastTransitionTime
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Reason
,
&
out
.
Reason
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Message
,
&
out
.
Message
,
0
);
err
!=
nil
{
return
err
}
return
nil
},
func
(
in
*
NodeCondition
,
out
*
newer
.
NodeCondition
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
Convert
(
&
in
.
Kind
,
&
out
.
Type
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Status
,
&
out
.
Status
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
LastProbeTime
,
&
out
.
LastProbeTime
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
LastTransitionTime
,
&
out
.
LastTransitionTime
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Reason
,
&
out
.
Reason
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Message
,
&
out
.
Message
,
0
);
err
!=
nil
{
return
err
}
return
nil
},
func
(
in
*
newer
.
NodeConditionType
,
out
*
NodeConditionKind
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
case
newer
.
NodeReachable
:
*
out
=
NodeReachable
break
case
newer
.
NodeReady
:
*
out
=
NodeReady
break
case
""
:
*
out
=
""
default
:
*
out
=
NodeConditionKind
(
*
in
)
break
}
return
nil
},
func
(
in
*
NodeConditionKind
,
out
*
newer
.
NodeConditionType
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
case
NodeReachable
:
*
out
=
newer
.
NodeReachable
break
case
NodeReady
:
*
out
=
newer
.
NodeReady
break
case
""
:
*
out
=
""
default
:
*
out
=
newer
.
NodeConditionType
(
*
in
)
break
}
return
nil
},
func
(
in
*
newer
.
PodCondition
,
out
*
PodCondition
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
Convert
(
&
in
.
Type
,
&
out
.
Kind
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Status
,
&
out
.
Status
,
0
);
err
!=
nil
{
return
err
}
return
nil
},
func
(
in
*
PodCondition
,
out
*
newer
.
PodCondition
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
Convert
(
&
in
.
Kind
,
&
out
.
Type
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Status
,
&
out
.
Status
,
0
);
err
!=
nil
{
return
err
}
return
nil
},
func
(
in
*
newer
.
PodConditionType
,
out
*
PodConditionKind
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
case
newer
.
PodReady
:
*
out
=
PodReady
break
case
""
:
*
out
=
""
default
:
*
out
=
PodConditionKind
(
*
in
)
break
}
return
nil
},
func
(
in
*
PodConditionKind
,
out
*
newer
.
PodConditionType
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
case
PodReady
:
*
out
=
newer
.
PodReady
break
case
""
:
*
out
=
""
default
:
*
out
=
newer
.
PodConditionType
(
*
in
)
break
}
return
nil
},
)
if
err
!=
nil
{
// If one of the conversion functions is malformed, detect it immediately.
...
...
pkg/api/v1beta2/conversion.go
View file @
5267127a
...
...
@@ -1073,6 +1073,132 @@ func init() {
}
return
nil
},
func
(
in
*
newer
.
NodeCondition
,
out
*
NodeCondition
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
Convert
(
&
in
.
Type
,
&
out
.
Kind
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Status
,
&
out
.
Status
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
LastProbeTime
,
&
out
.
LastProbeTime
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
LastTransitionTime
,
&
out
.
LastTransitionTime
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Reason
,
&
out
.
Reason
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Message
,
&
out
.
Message
,
0
);
err
!=
nil
{
return
err
}
return
nil
},
func
(
in
*
NodeCondition
,
out
*
newer
.
NodeCondition
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
Convert
(
&
in
.
Kind
,
&
out
.
Type
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Status
,
&
out
.
Status
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
LastProbeTime
,
&
out
.
LastProbeTime
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
LastTransitionTime
,
&
out
.
LastTransitionTime
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Reason
,
&
out
.
Reason
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Message
,
&
out
.
Message
,
0
);
err
!=
nil
{
return
err
}
return
nil
},
func
(
in
*
newer
.
NodeConditionType
,
out
*
NodeConditionKind
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
case
newer
.
NodeReachable
:
*
out
=
NodeReachable
break
case
newer
.
NodeReady
:
*
out
=
NodeReady
break
case
""
:
*
out
=
""
default
:
*
out
=
NodeConditionKind
(
*
in
)
break
}
return
nil
},
func
(
in
*
NodeConditionKind
,
out
*
newer
.
NodeConditionType
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
case
NodeReachable
:
*
out
=
newer
.
NodeReachable
break
case
NodeReady
:
*
out
=
newer
.
NodeReady
break
case
""
:
*
out
=
""
default
:
*
out
=
newer
.
NodeConditionType
(
*
in
)
break
}
return
nil
},
func
(
in
*
newer
.
PodCondition
,
out
*
PodCondition
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
Convert
(
&
in
.
Type
,
&
out
.
Kind
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Status
,
&
out
.
Status
,
0
);
err
!=
nil
{
return
err
}
return
nil
},
func
(
in
*
PodCondition
,
out
*
newer
.
PodCondition
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
Convert
(
&
in
.
Kind
,
&
out
.
Type
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
s
.
Convert
(
&
in
.
Status
,
&
out
.
Status
,
0
);
err
!=
nil
{
return
err
}
return
nil
},
func
(
in
*
newer
.
PodConditionType
,
out
*
PodConditionKind
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
case
newer
.
PodReady
:
*
out
=
PodReady
break
case
""
:
*
out
=
""
default
:
*
out
=
PodConditionKind
(
*
in
)
break
}
return
nil
},
func
(
in
*
PodConditionKind
,
out
*
newer
.
PodConditionType
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
case
PodReady
:
*
out
=
newer
.
PodReady
break
case
""
:
*
out
=
""
default
:
*
out
=
newer
.
PodConditionType
(
*
in
)
break
}
return
nil
},
)
if
err
!=
nil
{
// If one of the conversion functions is malformed, detect it immediately.
...
...
pkg/api/v1beta3/types.go
View file @
5267127a
...
...
@@ -490,20 +490,20 @@ const (
PodUnknown
PodPhase
=
"Unknown"
)
// PodCondition
Kind is a valid value for PodCondition.Kind
type
PodCondition
Kind
string
// PodCondition
Type is a valid value for PodCondition.Type
type
PodCondition
Type
string
// These are valid conditions of pod.
const
(
// PodReady means the pod is able to service requests and should be added to the
// load balancing pools of all matching services.
PodReady
PodCondition
Kind
=
"Ready"
PodReady
PodCondition
Type
=
"Ready"
)
// TODO: add LastTransitionTime, Reason, Message to match NodeCondition api.
type
PodCondition
struct
{
//
Status is the status
of the condition
Kind
PodConditionKind
`json:"kind
"`
//
Type is the type
of the condition
Type
PodConditionType
`json:"type
"`
// Status is the status of the condition
Status
ConditionStatus
`json:"status"`
}
...
...
@@ -838,20 +838,20 @@ const (
NodeTerminated
NodePhase
=
"Terminated"
)
type
NodeCondition
Kind
string
type
NodeCondition
Type
string
// These are valid conditions of node. Currently, we don't have enough information to decide
// node condition. In the future, we will add more. The proposed set of conditions are:
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.
const
(
// NodeReachable means the node can be reached (in the sense of HTTP connection) from node controller.
NodeReachable
NodeCondition
Kind
=
"Reachable"
NodeReachable
NodeCondition
Type
=
"Reachable"
// NodeReady means the node returns StatusOK for HTTP health check.
NodeReady
NodeCondition
Kind
=
"Ready"
NodeReady
NodeCondition
Type
=
"Ready"
)
type
NodeCondition
struct
{
Kind
NodeConditionKind
`json:"kind
"`
Type
NodeConditionType
`json:"type
"`
Status
ConditionStatus
`json:"status"`
LastProbeTime
util
.
Time
`json:"lastProbeTime,omitempty"`
LastTransitionTime
util
.
Time
`json:"lastTransitionTime,omitempty"`
...
...
pkg/cloudprovider/controller/nodecontroller.go
View file @
5267127a
...
...
@@ -304,21 +304,21 @@ func (s *NodeController) checkNodeReady(node *api.Node) *api.NodeCondition {
case
err
!=
nil
:
glog
.
V
(
2
)
.
Infof
(
"NodeController: node %s health check error: %v"
,
node
.
Name
,
err
)
return
&
api
.
NodeCondition
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionUnknown
,
Reason
:
fmt
.
Sprintf
(
"Node health check error: %v"
,
err
),
LastProbeTime
:
util
.
Now
(),
}
case
status
==
probe
.
Failure
:
return
&
api
.
NodeCondition
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionNone
,
Reason
:
fmt
.
Sprintf
(
"Node health check failed: kubelet /healthz endpoint returns not ok"
),
LastProbeTime
:
util
.
Now
(),
}
default
:
return
&
api
.
NodeCondition
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
,
Reason
:
fmt
.
Sprintf
(
"Node health check succeeded: kubelet /healthz endpoint returns ok"
),
LastProbeTime
:
util
.
Now
(),
...
...
@@ -405,10 +405,10 @@ func (s *NodeController) canonicalizeName(nodes *api.NodeList) *api.NodeList {
}
// getCondition returns a condition object for the specific condition
//
kind
, nil if the condition is not set.
func
(
s
*
NodeController
)
getCondition
(
node
*
api
.
Node
,
kind
api
.
NodeConditionKind
)
*
api
.
NodeCondition
{
//
type
, nil if the condition is not set.
func
(
s
*
NodeController
)
getCondition
(
node
*
api
.
Node
,
conditionType
api
.
NodeConditionType
)
*
api
.
NodeCondition
{
for
i
:=
range
node
.
Status
.
Conditions
{
if
node
.
Status
.
Conditions
[
i
]
.
Kind
==
kind
{
if
node
.
Status
.
Conditions
[
i
]
.
Type
==
conditionType
{
return
&
node
.
Status
.
Conditions
[
i
]
}
}
...
...
pkg/cloudprovider/controller/nodecontroller_test.go
View file @
5267127a
...
...
@@ -533,7 +533,7 @@ func TestHealthCheckNode(t *testing.T) {
},
expectedConditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
},
...
...
@@ -547,7 +547,7 @@ func TestHealthCheckNode(t *testing.T) {
},
expectedConditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionNone
,
Reason
:
"Node health check failed: kubelet /healthz endpoint returns not ok"
,
},
...
...
@@ -561,7 +561,7 @@ func TestHealthCheckNode(t *testing.T) {
},
expectedConditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionUnknown
,
Reason
:
"Node health check error: Error"
,
},
...
...
@@ -638,7 +638,7 @@ func TestSyncNodeStatusTransitionTime(t *testing.T) {
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
LastTransitionTime
:
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
...
...
@@ -664,7 +664,7 @@ func TestSyncNodeStatusTransitionTime(t *testing.T) {
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
LastTransitionTime
:
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
...
...
@@ -725,7 +725,7 @@ func TestSyncNodeStatusDeletePods(t *testing.T) {
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
LastTransitionTime
:
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
...
...
@@ -755,7 +755,7 @@ func TestSyncNodeStatusDeletePods(t *testing.T) {
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
LastTransitionTime
:
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
...
...
@@ -784,7 +784,7 @@ func TestSyncNodeStatusDeletePods(t *testing.T) {
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionNone
,
Reason
:
"Node health check failed: kubelet /healthz endpoint returns not ok"
,
// Here, last transition time is Now(). In node controller, the new condition's probe time is
...
...
@@ -816,7 +816,7 @@ func TestSyncNodeStatusDeletePods(t *testing.T) {
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionNone
,
Reason
:
"Node health check failed: kubelet /healthz endpoint returns not ok"
,
// Here, last transition time is in the past, and in node controller, the
...
...
@@ -881,7 +881,7 @@ func TestSyncNodeStatus(t *testing.T) {
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
},
...
...
@@ -894,7 +894,7 @@ func TestSyncNodeStatus(t *testing.T) {
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
},
...
...
pkg/kubectl/describe.go
View file @
5267127a
...
...
@@ -194,10 +194,10 @@ func (d *PodDescriber) Describe(namespace, name string) (string, error) {
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
)))
if
len
(
pod
.
Status
.
Conditions
)
>
0
{
fmt
.
Fprint
(
out
,
"Conditions:
\n
Kind
\t
Status
\n
"
)
fmt
.
Fprint
(
out
,
"Conditions:
\n
Type
\t
Status
\n
"
)
for
_
,
c
:=
range
pod
.
Status
.
Conditions
{
fmt
.
Fprintf
(
out
,
" %v
\t
%v
\n
"
,
c
.
Kind
,
c
.
Type
,
c
.
Status
)
}
}
...
...
@@ -312,10 +312,10 @@ func (d *MinionDescriber) Describe(namespace, name string) (string, error) {
return
tabbedString
(
func
(
out
io
.
Writer
)
error
{
fmt
.
Fprintf
(
out
,
"Name:
\t
%s
\n
"
,
minion
.
Name
)
if
len
(
minion
.
Status
.
Conditions
)
>
0
{
fmt
.
Fprint
(
out
,
"Conditions:
\n
Kind
\t
Status
\t
LastProbeTime
\t
LastTransitionTime
\t
Reason
\t
Message
\n
"
)
fmt
.
Fprint
(
out
,
"Conditions:
\n
Type
\t
Status
\t
LastProbeTime
\t
LastTransitionTime
\t
Reason
\t
Message
\n
"
)
for
_
,
c
:=
range
minion
.
Status
.
Conditions
{
fmt
.
Fprintf
(
out
,
" %v
\t
%v
\t
%s
\t
%s
\t
%v
\t
%v
\n
"
,
c
.
Kind
,
c
.
Type
,
c
.
Status
,
c
.
LastProbeTime
.
Time
.
Format
(
time
.
RFC1123Z
),
c
.
LastTransitionTime
.
Time
.
Format
(
time
.
RFC1123Z
),
...
...
pkg/kubectl/resource_printer.go
View file @
5267127a
...
...
@@ -409,19 +409,19 @@ func printSecretList(list *api.SecretList, w io.Writer) error {
}
func
printNode
(
node
*
api
.
Node
,
w
io
.
Writer
)
error
{
conditionMap
:=
make
(
map
[
api
.
NodeCondition
Kind
]
*
api
.
NodeCondition
)
NodeAllConditions
:=
[]
api
.
NodeCondition
Kind
{
api
.
NodeReady
,
api
.
NodeReachable
}
conditionMap
:=
make
(
map
[
api
.
NodeCondition
Type
]
*
api
.
NodeCondition
)
NodeAllConditions
:=
[]
api
.
NodeCondition
Type
{
api
.
NodeReady
,
api
.
NodeReachable
}
for
i
:=
range
node
.
Status
.
Conditions
{
cond
:=
node
.
Status
.
Conditions
[
i
]
conditionMap
[
cond
.
Kind
]
=
&
cond
conditionMap
[
cond
.
Type
]
=
&
cond
}
var
status
[]
string
for
_
,
validCondition
:=
range
NodeAllConditions
{
if
condition
,
ok
:=
conditionMap
[
validCondition
];
ok
{
if
condition
.
Status
==
api
.
ConditionFull
{
status
=
append
(
status
,
string
(
condition
.
Kind
))
status
=
append
(
status
,
string
(
condition
.
Type
))
}
else
{
status
=
append
(
status
,
"Not"
+
string
(
condition
.
Kind
))
status
=
append
(
status
,
"Not"
+
string
(
condition
.
Type
))
}
}
}
...
...
pkg/kubectl/resource_printer_test.go
View file @
5267127a
...
...
@@ -524,7 +524,7 @@ func TestPrintMinionStatus(t *testing.T) {
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo1"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
}}},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
}}},
},
status
:
"Ready"
,
},
...
...
@@ -532,8 +532,8 @@ func TestPrintMinionStatus(t *testing.T) {
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo2"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Kind
:
api
.
NodeReachable
,
Status
:
api
.
ConditionFull
}}},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
ConditionFull
}}},
},
status
:
"Ready,Reachable"
,
},
...
...
@@ -541,22 +541,22 @@ func TestPrintMinionStatus(t *testing.T) {
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo3"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
}}},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
}}},
},
status
:
"Ready"
,
},
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo4"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionNone
}}},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionNone
}}},
},
status
:
"NotReady"
,
},
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo5"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Kind
:
"InvalidValue"
,
Status
:
api
.
ConditionFull
}}},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
"InvalidValue"
,
Status
:
api
.
ConditionFull
}}},
},
status
:
"Unknown"
,
},
...
...
pkg/kubelet/kubelet.go
View file @
5267127a
...
...
@@ -1592,11 +1592,11 @@ func getPhase(spec *api.PodSpec, info api.PodInfo) api.PodPhase {
// getPodReadyCondition returns ready condition if all containers in a pod are ready, else it returns an unready condition.
func
getPodReadyCondition
(
spec
*
api
.
PodSpec
,
info
api
.
PodInfo
)
[]
api
.
PodCondition
{
ready
:=
[]
api
.
PodCondition
{{
Kind
:
api
.
PodReady
,
Type
:
api
.
PodReady
,
Status
:
api
.
ConditionFull
,
}}
unready
:=
[]
api
.
PodCondition
{{
Kind
:
api
.
PodReady
,
Type
:
api
.
PodReady
,
Status
:
api
.
ConditionNone
,
}}
if
info
==
nil
{
...
...
pkg/kubelet/kubelet_test.go
View file @
5267127a
...
...
@@ -2742,11 +2742,11 @@ func TestPodPhaseWithRestartOnFailure(t *testing.T) {
func
TestGetPodReadyCondition
(
t
*
testing
.
T
)
{
ready
:=
[]
api
.
PodCondition
{{
Kind
:
api
.
PodReady
,
Type
:
api
.
PodReady
,
Status
:
api
.
ConditionFull
,
}}
unready
:=
[]
api
.
PodCondition
{{
Kind
:
api
.
PodReady
,
Type
:
api
.
PodReady
,
Status
:
api
.
ConditionNone
,
}}
tests
:=
[]
struct
{
...
...
pkg/master/pod_cache.go
View file @
5267127a
...
...
@@ -180,7 +180,7 @@ func (p *PodCache) computePodStatus(pod *api.Pod) (api.PodStatus, error) {
// Assigned to an unhealthy node.
for
_
,
condition
:=
range
nodeStatus
.
Conditions
{
if
(
condition
.
Kind
==
api
.
NodeReady
||
condition
.
Kind
==
api
.
NodeReachable
)
&&
condition
.
Status
==
api
.
ConditionNone
{
if
(
condition
.
Type
==
api
.
NodeReady
||
condition
.
Type
==
api
.
NodeReachable
)
&&
condition
.
Status
==
api
.
ConditionNone
{
glog
.
V
(
5
)
.
Infof
(
"node status: %v, setting pod %q status to unknown"
,
condition
,
pod
.
Name
)
newStatus
.
Phase
=
api
.
PodUnknown
newStatus
.
Conditions
=
append
(
newStatus
.
Conditions
,
pod
.
Status
.
Conditions
...
)
...
...
pkg/master/pod_cache_test.go
View file @
5267127a
...
...
@@ -226,7 +226,7 @@ func makeHealthyNode(name string, ip string) *api.Node {
Status
:
api
.
NodeStatus
{
HostIP
:
ip
,
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
},
},
}
...
...
@@ -236,7 +236,7 @@ func makeUnhealthyNode(name string) *api.Node {
return
&
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
name
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionNone
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionNone
},
}},
}
}
...
...
pkg/service/endpoints_controller.go
View file @
5267127a
...
...
@@ -77,7 +77,7 @@ func (e *EndpointController) SyncServiceEndpoints() error {
inService
:=
false
for
_
,
c
:=
range
pod
.
Status
.
Conditions
{
if
c
.
Kind
==
api
.
PodReady
&&
c
.
Status
==
api
.
ConditionFull
{
if
c
.
Type
==
api
.
PodReady
&&
c
.
Status
==
api
.
ConditionFull
{
inService
=
true
break
}
...
...
pkg/service/endpoints_controller_test.go
View file @
5267127a
...
...
@@ -51,7 +51,7 @@ func newPodList(count int) *api.PodList {
PodIP
:
"1.2.3.4"
,
Conditions
:
[]
api
.
PodCondition
{
{
Kind
:
api
.
PodReady
,
Type
:
api
.
PodReady
,
Status
:
api
.
ConditionFull
,
},
},
...
...
plugin/pkg/scheduler/factory/factory.go
View file @
5267127a
...
...
@@ -179,10 +179,10 @@ func (factory *ConfigFactory) pollMinions() (cache.Enumerator, error) {
ListMeta
:
allNodes
.
ListMeta
,
}
for
_
,
node
:=
range
allNodes
.
Items
{
conditionMap
:=
make
(
map
[
api
.
NodeCondition
Kind
]
*
api
.
NodeCondition
)
conditionMap
:=
make
(
map
[
api
.
NodeCondition
Type
]
*
api
.
NodeCondition
)
for
i
:=
range
node
.
Status
.
Conditions
{
cond
:=
node
.
Status
.
Conditions
[
i
]
conditionMap
[
cond
.
Kind
]
=
&
cond
conditionMap
[
cond
.
Type
]
=
&
cond
}
if
condition
,
ok
:=
conditionMap
[
api
.
NodeReady
];
ok
{
if
condition
.
Status
==
api
.
ConditionFull
{
...
...
plugin/pkg/scheduler/factory/factory_test.go
View file @
5267127a
...
...
@@ -57,7 +57,7 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
},
},
},
...
...
@@ -65,7 +65,7 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"bar"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReachable
,
Status
:
api
.
ConditionFull
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
ConditionFull
},
},
},
},
...
...
@@ -73,8 +73,8 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"baz"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Kind
:
api
.
NodeReachable
,
Status
:
api
.
ConditionFull
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
ConditionFull
},
},
},
},
...
...
@@ -82,8 +82,8 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"baz"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
},
},
},
...
...
@@ -96,7 +96,7 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
},
},
},
...
...
@@ -104,7 +104,7 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"bar"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionNone
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionNone
},
},
},
},
...
...
@@ -117,8 +117,8 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Kind
:
api
.
NodeReachable
,
Status
:
api
.
ConditionNone
}},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionFull
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
ConditionNone
}},
},
},
},
...
...
@@ -130,8 +130,8 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Kind
:
api
.
NodeReachable
,
Status
:
api
.
ConditionFull
},
{
Kind
:
"invalidValue"
,
Status
:
api
.
ConditionNone
}},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
ConditionFull
},
{
Type
:
"invalidValue"
,
Status
:
api
.
ConditionNone
}},
},
},
},
...
...
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