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
ca68f4a9
Commit
ca68f4a9
authored
Mar 23, 2015
by
Deyuan Deng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename ConditionFull->ConditionTrue, ConditionNone->ConditionFalse
parent
064b7dec
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
152 additions
and
98 deletions
+152
-98
node.md
docs/node.md
+3
-3
types.go
pkg/api/types.go
+4
-4
conversion.go
pkg/api/v1beta1/conversion.go
+29
-1
conversion.go
pkg/api/v1beta2/conversion.go
+29
-3
types.go
pkg/api/v1beta3/types.go
+4
-4
nodecontroller.go
pkg/cloudprovider/controller/nodecontroller.go
+6
-6
nodecontroller_test.go
pkg/cloudprovider/controller/nodecontroller_test.go
+21
-21
resource_printer.go
pkg/kubectl/resource_printer.go
+1
-1
resource_printer_test.go
pkg/kubectl/resource_printer_test.go
+13
-13
kubelet.go
pkg/kubelet/kubelet.go
+3
-3
kubelet_test.go
pkg/kubelet/kubelet_test.go
+5
-5
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
+3
-3
factory_test.go
plugin/pkg/scheduler/factory/factory_test.go
+26
-26
No files found.
docs/node.md
View file @
ca68f4a9
...
...
@@ -52,15 +52,15 @@ sane state but not allowed to accept new pods:
"conditions"
:
[
{
"kind"
:
"Reachable"
,
"status"
:
"
Full
"
,
"status"
:
"
True
"
,
},
{
"kind"
:
"Ready"
,
"status"
:
"
Full
"
,
"status"
:
"
True
"
,
},
{
"kind"
:
"Schedulable"
,
"status"
:
"
Non
e"
,
"status"
:
"
Fals
e"
,
},
]
```
...
...
pkg/api/types.go
View file @
ca68f4a9
...
...
@@ -437,13 +437,13 @@ type Lifecycle struct {
type
ConditionStatus
string
// These are valid condition statuses. "Condition
Full
" means a resource is in the condition;
// "Condition
Non
e" means a resource is not in the condition; "ConditionUnknown" means kubernetes
// These are valid condition statuses. "Condition
True
" means a resource is in the condition;
// "Condition
Fals
e" means a resource is not in the condition; "ConditionUnknown" means kubernetes
// can't decide if a resource is in the condition or not. In the future, we could add other
// intermediate conditions, e.g. ConditionDegraded.
const
(
Condition
Full
ConditionStatus
=
"Full
"
Condition
None
ConditionStatus
=
"Non
e"
Condition
True
ConditionStatus
=
"True
"
Condition
False
ConditionStatus
=
"Fals
e"
ConditionUnknown
ConditionStatus
=
"Unknown"
)
...
...
pkg/api/v1beta1/conversion.go
View file @
ca68f4a9
...
...
@@ -1291,7 +1291,6 @@ func init() {
*
out
=
NodeConditionKind
(
*
in
)
break
}
return
nil
},
func
(
in
*
NodeConditionKind
,
out
*
newer
.
NodeConditionType
,
s
conversion
.
Scope
)
error
{
...
...
@@ -1308,7 +1307,35 @@ func init() {
*
out
=
newer
.
NodeConditionType
(
*
in
)
break
}
return
nil
},
func
(
in
*
newer
.
ConditionStatus
,
out
*
ConditionStatus
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
case
newer
.
ConditionTrue
:
*
out
=
ConditionFull
break
case
newer
.
ConditionFalse
:
*
out
=
ConditionNone
break
default
:
*
out
=
ConditionStatus
(
*
in
)
break
}
return
nil
},
func
(
in
*
ConditionStatus
,
out
*
newer
.
ConditionStatus
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
case
ConditionFull
:
*
out
=
newer
.
ConditionTrue
break
case
ConditionNone
:
*
out
=
newer
.
ConditionFalse
break
default
:
*
out
=
newer
.
ConditionStatus
(
*
in
)
break
}
return
nil
},
...
...
@@ -1359,6 +1386,7 @@ func init() {
return
nil
},
func
(
in
*
Binding
,
out
*
newer
.
Binding
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
DefaultConvert
(
in
,
out
,
conversion
.
IgnoreMissingFields
);
err
!=
nil
{
return
err
...
...
pkg/api/v1beta2/conversion.go
View file @
ca68f4a9
...
...
@@ -1219,7 +1219,6 @@ func init() {
*
out
=
NodeConditionKind
(
*
in
)
break
}
return
nil
},
func
(
in
*
NodeConditionKind
,
out
*
newer
.
NodeConditionType
,
s
conversion
.
Scope
)
error
{
...
...
@@ -1236,7 +1235,35 @@ func init() {
*
out
=
newer
.
NodeConditionType
(
*
in
)
break
}
return
nil
},
func
(
in
*
newer
.
ConditionStatus
,
out
*
ConditionStatus
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
case
newer
.
ConditionTrue
:
*
out
=
ConditionFull
break
case
newer
.
ConditionFalse
:
*
out
=
ConditionNone
break
default
:
*
out
=
ConditionStatus
(
*
in
)
break
}
return
nil
},
func
(
in
*
ConditionStatus
,
out
*
newer
.
ConditionStatus
,
s
conversion
.
Scope
)
error
{
switch
*
in
{
case
ConditionFull
:
*
out
=
newer
.
ConditionTrue
break
case
ConditionNone
:
*
out
=
newer
.
ConditionFalse
break
default
:
*
out
=
newer
.
ConditionStatus
(
*
in
)
break
}
return
nil
},
...
...
@@ -1270,7 +1297,6 @@ func init() {
*
out
=
PodConditionKind
(
*
in
)
break
}
return
nil
},
func
(
in
*
PodConditionKind
,
out
*
newer
.
PodConditionType
,
s
conversion
.
Scope
)
error
{
...
...
@@ -1284,9 +1310,9 @@ func init() {
*
out
=
newer
.
PodConditionType
(
*
in
)
break
}
return
nil
},
func
(
in
*
Binding
,
out
*
newer
.
Binding
,
s
conversion
.
Scope
)
error
{
if
err
:=
s
.
DefaultConvert
(
in
,
out
,
conversion
.
IgnoreMissingFields
);
err
!=
nil
{
return
err
...
...
pkg/api/v1beta3/types.go
View file @
ca68f4a9
...
...
@@ -451,13 +451,13 @@ type Lifecycle struct {
type
ConditionStatus
string
// These are valid condition statuses. "Condition
Full
" means a resource is in the condition;
// "Condition
Non
e" means a resource is not in the condition; "ConditionUnknown" means kubernetes
// These are valid condition statuses. "Condition
True
" means a resource is in the condition;
// "Condition
Fals
e" means a resource is not in the condition; "ConditionUnknown" means kubernetes
// can't decide if a resource is in the condition or not. In the future, we could add other
// intermediate conditions, e.g. ConditionDegraded.
const
(
Condition
Full
ConditionStatus
=
"Full
"
Condition
None
ConditionStatus
=
"Non
e"
Condition
True
ConditionStatus
=
"True
"
Condition
False
ConditionStatus
=
"Fals
e"
ConditionUnknown
ConditionStatus
=
"Unknown"
)
...
...
pkg/cloudprovider/controller/nodecontroller.go
View file @
ca68f4a9
...
...
@@ -301,7 +301,7 @@ func (nc *NodeController) DoCheck(node *api.Node) []api.NodeCondition {
oldReadyCondition
:=
nc
.
getCondition
(
node
,
api
.
NodeReady
)
newReadyCondition
:=
nc
.
checkNodeReady
(
node
)
nc
.
updateLastTransitionTime
(
oldReadyCondition
,
newReadyCondition
)
if
newReadyCondition
.
Status
!=
api
.
Condition
Full
{
if
newReadyCondition
.
Status
!=
api
.
Condition
True
{
// Node is not ready for this probe, we need to check if pods need to be deleted.
if
newReadyCondition
.
LastProbeTime
.
After
(
newReadyCondition
.
LastTransitionTime
.
Add
(
nc
.
podEvictionTimeout
))
{
// As long as the node fails, we call delete pods to delete all pods. Node controller sync
...
...
@@ -338,14 +338,14 @@ func (nc *NodeController) checkNodeSchedulable(node *api.Node) *api.NodeConditio
if
node
.
Spec
.
Unschedulable
{
return
&
api
.
NodeCondition
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Non
e
,
Status
:
api
.
Condition
Fals
e
,
Reason
:
"User marked unschedulable during node create/update"
,
LastProbeTime
:
nc
.
now
(),
}
}
else
{
return
&
api
.
NodeCondition
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node is schedulable by default"
,
LastProbeTime
:
nc
.
now
(),
}
...
...
@@ -366,14 +366,14 @@ func (nc *NodeController) checkNodeReady(node *api.Node) *api.NodeCondition {
case
status
==
probe
.
Failure
:
return
&
api
.
NodeCondition
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Non
e
,
Status
:
api
.
Condition
Fals
e
,
Reason
:
fmt
.
Sprintf
(
"Node health check failed: kubelet /healthz endpoint returns not ok"
),
LastProbeTime
:
nc
.
now
(),
}
default
:
return
&
api
.
NodeCondition
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
fmt
.
Sprintf
(
"Node health check succeeded: kubelet /healthz endpoint returns ok"
),
LastProbeTime
:
nc
.
now
(),
}
...
...
@@ -481,7 +481,7 @@ func (nc *NodeController) MonitorNodeStatus() error {
if
readyCondition
!=
nil
{
// Check eviction timeout.
if
lastReadyCondition
.
Status
==
api
.
Condition
Non
e
&&
if
lastReadyCondition
.
Status
==
api
.
Condition
Fals
e
&&
nc
.
now
()
.
After
(
lastReadyCondition
.
LastTransitionTime
.
Add
(
nc
.
podEvictionTimeout
))
{
// Node stays in not ready for at least 'podEvictionTimeout' - evict all pods on the unhealthy node.
nc
.
deletePods
(
node
.
Name
)
...
...
pkg/cloudprovider/controller/nodecontroller_test.go
View file @
ca68f4a9
...
...
@@ -580,14 +580,14 @@ func TestNodeConditionsCheck(t *testing.T) {
expectedConditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
LastProbeTime
:
fakeNow
,
LastTransitionTime
:
fakeNow
,
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node is schedulable by default"
,
LastProbeTime
:
fakeNow
,
LastTransitionTime
:
fakeNow
,
...
...
@@ -605,14 +605,14 @@ func TestNodeConditionsCheck(t *testing.T) {
expectedConditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Non
e
,
Status
:
api
.
Condition
Fals
e
,
Reason
:
"Node health check failed: kubelet /healthz endpoint returns not ok"
,
LastProbeTime
:
fakeNow
,
LastTransitionTime
:
fakeNow
,
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node is schedulable by default"
,
LastProbeTime
:
fakeNow
,
LastTransitionTime
:
fakeNow
,
...
...
@@ -637,7 +637,7 @@ func TestNodeConditionsCheck(t *testing.T) {
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Non
e
,
Status
:
api
.
Condition
Fals
e
,
Reason
:
"User marked unschedulable during node create/update"
,
LastProbeTime
:
fakeNow
,
LastTransitionTime
:
fakeNow
,
...
...
@@ -719,14 +719,14 @@ func TestSyncProbedNodeStatus(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
LastProbeTime
:
fakeNow
,
LastTransitionTime
:
fakeNow
,
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node is schedulable by default"
,
LastProbeTime
:
fakeNow
,
LastTransitionTime
:
fakeNow
,
...
...
@@ -743,14 +743,14 @@ func TestSyncProbedNodeStatus(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
LastProbeTime
:
fakeNow
,
LastTransitionTime
:
fakeNow
,
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node is schedulable by default"
,
LastProbeTime
:
fakeNow
,
LastTransitionTime
:
fakeNow
,
...
...
@@ -810,13 +810,13 @@ func TestSyncProbedNodeStatusTransitionTime(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
LastTransitionTime
:
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node is schedulable by default"
,
LastTransitionTime
:
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
},
...
...
@@ -845,13 +845,13 @@ func TestSyncProbedNodeStatusTransitionTime(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
LastTransitionTime
:
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node is schedulable by default"
,
LastTransitionTime
:
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
},
...
...
@@ -906,7 +906,7 @@ func TestSyncProbedNodeStatusEvictPods(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
LastTransitionTime
:
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
},
...
...
@@ -936,7 +936,7 @@ func TestSyncProbedNodeStatusEvictPods(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
"Node health check succeeded: kubelet /healthz endpoint returns ok"
,
LastTransitionTime
:
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
},
...
...
@@ -965,7 +965,7 @@ func TestSyncProbedNodeStatusEvictPods(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Non
e
,
Status
:
api
.
Condition
Fals
e
,
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
// also Now(). The two calls to Now() yields differnt time due to test execution, but the
...
...
@@ -997,7 +997,7 @@ func TestSyncProbedNodeStatusEvictPods(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Non
e
,
Status
:
api
.
Condition
Fals
e
,
Reason
:
"Node health check failed: kubelet /healthz endpoint returns not ok"
,
// Here, last transition time is in the past, and in node controller, the
// new condition's probe time is Now(). The time difference is larger than
...
...
@@ -1075,7 +1075,7 @@ func TestMonitorNodeStatusEvictPods(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Non
e
,
Status
:
api
.
Condition
Fals
e
,
// Node status has just been updated, and transited to NotReady for 10min.
LastProbeTime
:
util
.
Date
(
2015
,
1
,
1
,
11
,
59
,
0
,
0
,
time
.
UTC
),
LastTransitionTime
:
util
.
Date
(
2015
,
1
,
1
,
11
,
50
,
0
,
0
,
time
.
UTC
),
...
...
@@ -1104,7 +1104,7 @@ func TestMonitorNodeStatusEvictPods(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Non
e
,
Status
:
api
.
Condition
Fals
e
,
// Node status has just been updated, and transited to NotReady for 1hr.
LastProbeTime
:
util
.
Date
(
2015
,
1
,
1
,
11
,
59
,
0
,
0
,
time
.
UTC
),
LastTransitionTime
:
util
.
Date
(
2015
,
1
,
1
,
11
,
0
,
0
,
0
,
time
.
UTC
),
...
...
@@ -1275,7 +1275,7 @@ func TestMonitorNodeStatusUpdateStatus(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
// Node status hasn't been updated for 1hr.
LastProbeTime
:
util
.
Date
(
2015
,
1
,
1
,
11
,
0
,
0
,
0
,
time
.
UTC
),
LastTransitionTime
:
util
.
Date
(
2015
,
1
,
1
,
11
,
0
,
0
,
0
,
time
.
UTC
),
...
...
@@ -1323,7 +1323,7 @@ func TestMonitorNodeStatusUpdateStatus(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
// Node status has just been updated.
LastProbeTime
:
fakeNow
,
LastTransitionTime
:
fakeNow
,
...
...
pkg/kubectl/resource_printer.go
View file @
ca68f4a9
...
...
@@ -440,7 +440,7 @@ func printNode(node *api.Node, w io.Writer) error {
var
status
[]
string
for
_
,
validCondition
:=
range
NodeAllConditions
{
if
condition
,
ok
:=
conditionMap
[
validCondition
];
ok
{
if
condition
.
Status
==
api
.
Condition
Full
{
if
condition
.
Status
==
api
.
Condition
True
{
status
=
append
(
status
,
string
(
condition
.
Type
))
}
else
{
status
=
append
(
status
,
"Not"
+
string
(
condition
.
Type
))
...
...
pkg/kubectl/resource_printer_test.go
View file @
ca68f4a9
...
...
@@ -524,7 +524,7 @@ func TestPrintMinionStatus(t *testing.T) {
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo1"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
}}},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
}}},
},
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
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Full
}}},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
True
}}},
},
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
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
}}},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
}}},
},
status
:
"Ready"
,
},
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo4"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Non
e
}}},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Fals
e
}}},
},
status
:
"NotReady"
,
},
{
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo5"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
"InvalidValue"
,
Status
:
api
.
Condition
Full
}}},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{{
Type
:
"InvalidValue"
,
Status
:
api
.
Condition
True
}}},
},
status
:
"Unknown"
,
},
...
...
@@ -571,9 +571,9 @@ func TestPrintMinionStatus(t *testing.T) {
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo7"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Full
}}},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
True
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
True
}}},
},
status
:
"Schedulable,Ready,Reachable"
,
},
...
...
@@ -581,9 +581,9 @@ func TestPrintMinionStatus(t *testing.T) {
minion
:
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo8"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Non
e
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Non
e
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Full
}}},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Fals
e
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Fals
e
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
True
}}},
},
status
:
"NotSchedulable,NotReady,Reachable"
,
},
...
...
pkg/kubelet/kubelet.go
View file @
ca68f4a9
...
...
@@ -1850,7 +1850,7 @@ func (kl *Kubelet) tryUpdateNodeStatus() error {
currentTime
:=
util
.
Now
()
newCondition
:=
api
.
NodeCondition
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
fmt
.
Sprintf
(
"kubelet is posting ready status"
),
LastProbeTime
:
currentTime
,
}
...
...
@@ -1937,11 +1937,11 @@ func getPhase(spec *api.PodSpec, info api.PodInfo) api.PodPhase {
func
getPodReadyCondition
(
spec
*
api
.
PodSpec
,
info
api
.
PodInfo
)
[]
api
.
PodCondition
{
ready
:=
[]
api
.
PodCondition
{{
Type
:
api
.
PodReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
}}
unready
:=
[]
api
.
PodCondition
{{
Type
:
api
.
PodReady
,
Status
:
api
.
Condition
Non
e
,
Status
:
api
.
Condition
Fals
e
,
}}
if
info
==
nil
{
return
unready
...
...
pkg/kubelet/kubelet_test.go
View file @
ca68f4a9
...
...
@@ -2465,11 +2465,11 @@ func TestPodPhaseWithRestartOnFailure(t *testing.T) {
func
TestGetPodReadyCondition
(
t
*
testing
.
T
)
{
ready
:=
[]
api
.
PodCondition
{{
Type
:
api
.
PodReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
}}
unready
:=
[]
api
.
PodCondition
{{
Type
:
api
.
PodReady
,
Status
:
api
.
Condition
Non
e
,
Status
:
api
.
Condition
Fals
e
,
}}
tests
:=
[]
struct
{
spec
*
api
.
PodSpec
...
...
@@ -3103,7 +3103,7 @@ func TestUpdateNewNodeStatus(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
fmt
.
Sprintf
(
"kubelet is posting ready status"
),
LastProbeTime
:
util
.
Time
{},
LastTransitionTime
:
util
.
Time
{},
...
...
@@ -3157,7 +3157,7 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
fmt
.
Sprintf
(
"kubelet is posting ready status"
),
LastProbeTime
:
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
LastTransitionTime
:
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
...
...
@@ -3180,7 +3180,7 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
Reason
:
fmt
.
Sprintf
(
"kubelet is posting ready status"
),
LastProbeTime
:
util
.
Time
{},
// placeholder
LastTransitionTime
:
util
.
Time
{},
// placeholder
...
...
pkg/master/pod_cache.go
View file @
ca68f4a9
...
...
@@ -198,7 +198,7 @@ func (p *PodCache) computePodStatus(pod *api.Pod) (api.PodStatus, error) {
// Assigned to an unhealthy node.
for
_
,
condition
:=
range
nodeStatus
.
Conditions
{
if
(
condition
.
Type
==
api
.
NodeReady
||
condition
.
Type
==
api
.
NodeReachable
)
&&
condition
.
Status
==
api
.
Condition
Non
e
{
if
(
condition
.
Type
==
api
.
NodeReady
||
condition
.
Type
==
api
.
NodeReachable
)
&&
condition
.
Status
==
api
.
Condition
Fals
e
{
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 @
ca68f4a9
...
...
@@ -228,7 +228,7 @@ func makeHealthyNode(name string, ip string) *api.Node {
{
Type
:
api
.
NodeLegacyHostIP
,
Address
:
ip
},
},
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
},
},
},
}
...
...
@@ -238,7 +238,7 @@ func makeUnhealthyNode(name string) *api.Node {
return
&
api
.
Node
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
name
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Non
e
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Fals
e
},
}},
}
}
...
...
pkg/service/endpoints_controller.go
View file @
ca68f4a9
...
...
@@ -83,7 +83,7 @@ func (e *EndpointController) SyncServiceEndpoints() error {
inService
:=
false
for
_
,
c
:=
range
pod
.
Status
.
Conditions
{
if
c
.
Type
==
api
.
PodReady
&&
c
.
Status
==
api
.
Condition
Full
{
if
c
.
Type
==
api
.
PodReady
&&
c
.
Status
==
api
.
Condition
True
{
inService
=
true
break
}
...
...
pkg/service/endpoints_controller_test.go
View file @
ca68f4a9
...
...
@@ -52,7 +52,7 @@ func newPodList(count int) *api.PodList {
Conditions
:
[]
api
.
PodCondition
{
{
Type
:
api
.
PodReady
,
Status
:
api
.
Condition
Full
,
Status
:
api
.
Condition
True
,
},
},
},
...
...
plugin/pkg/scheduler/factory/factory.go
View file @
ca68f4a9
...
...
@@ -216,16 +216,16 @@ func (factory *ConfigFactory) pollMinions() (cache.Enumerator, error) {
conditionMap
[
cond
.
Type
]
=
&
cond
}
if
condition
,
ok
:=
conditionMap
[
api
.
NodeSchedulable
];
ok
{
if
condition
.
Status
!=
api
.
Condition
Full
{
if
condition
.
Status
!=
api
.
Condition
True
{
continue
}
}
if
condition
,
ok
:=
conditionMap
[
api
.
NodeReady
];
ok
{
if
condition
.
Status
==
api
.
Condition
Full
{
if
condition
.
Status
==
api
.
Condition
True
{
nodes
.
Items
=
append
(
nodes
.
Items
,
node
)
}
}
else
if
condition
,
ok
:=
conditionMap
[
api
.
NodeReachable
];
ok
{
if
condition
.
Status
==
api
.
Condition
Full
{
if
condition
.
Status
==
api
.
Condition
True
{
nodes
.
Items
=
append
(
nodes
.
Items
,
node
)
}
}
else
{
...
...
plugin/pkg/scheduler/factory/factory_test.go
View file @
ca68f4a9
...
...
@@ -143,7 +143,7 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
},
},
},
},
...
...
@@ -151,7 +151,7 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"bar"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
True
},
},
},
},
...
...
@@ -159,7 +159,7 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"fiz"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
True
},
},
},
},
...
...
@@ -167,8 +167,8 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"biz"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
True
},
},
},
},
...
...
@@ -176,8 +176,8 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"baz"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
},
},
},
},
...
...
@@ -185,9 +185,9 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"fuz"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
True
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
True
},
},
},
},
...
...
@@ -195,9 +195,9 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"buz"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Non
e
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Fals
e
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
True
},
},
},
},
...
...
@@ -205,9 +205,9 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foobar"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Non
e
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
True
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Fals
e
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
True
},
},
},
},
...
...
@@ -215,8 +215,8 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"fizbiz"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Non
e
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
True
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Fals
e
},
},
},
},
...
...
@@ -229,7 +229,7 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
},
},
},
},
...
...
@@ -237,7 +237,7 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"bar"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Non
e
},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Fals
e
},
},
},
},
...
...
@@ -250,7 +250,7 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
True
},
},
},
},
...
...
@@ -258,7 +258,7 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"bar"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Non
e
},
{
Type
:
api
.
NodeSchedulable
,
Status
:
api
.
Condition
Fals
e
},
},
},
},
...
...
@@ -271,8 +271,8 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
Full
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Non
e
}},
{
Type
:
api
.
NodeReady
,
Status
:
api
.
Condition
True
},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Fals
e
}},
},
},
},
...
...
@@ -284,8 +284,8 @@ func TestPollMinions(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
},
Status
:
api
.
NodeStatus
{
Conditions
:
[]
api
.
NodeCondition
{
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
Full
},
{
Type
:
"invalidValue"
,
Status
:
api
.
Condition
Non
e
}},
{
Type
:
api
.
NodeReachable
,
Status
:
api
.
Condition
True
},
{
Type
:
"invalidValue"
,
Status
:
api
.
Condition
Fals
e
}},
},
},
},
...
...
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