Remove Reachable Condition

This commit is contained in:
Deyuan Deng 2015-03-27 16:36:03 -04:00 committed by Deyuan Deng
parent b9babb56b0
commit 6bb9701489
14 changed files with 878 additions and 587 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -38,26 +38,20 @@ must have appropriate conditions, see below.
### Node Condition ### Node Condition
Node Condition describes the conditions of `Running` nodes. Current valid Node Condition describes the conditions of `Running` nodes. Current valid
conditions are `NodeReachable`, `NodeReady` and `NodeSchedulable`. In the conditions are `NodeReady` and `NodeSchedulable`. In the future, we plan to
future, we plan to add more. `NodeReachable` means the node can be reached add more. `NodeReady` means kubelet is healthy and ready to accept pods
within the cluster. `NodeReady` means the kubelet returns StatusOK for HTTP `NodeSchedulable` means node is allowed to schedule any new pods and is
health check. `NodeSchedulable` means node is allowed to schedule any new controlled by 'unschedulable' field in node spec. Different condition provides
pods and is controlled by 'unschedulable' field in node spec. different level of understanding for node health. Kubernetes will make a
Different condition provides different level of understanding for node comprehensive scheduling decision based on the information. Node condition
health. Kubernetes will make a comprehensive scheduling decision based on the is represented as a json object. For example, the following conditions mean
information. Node condition is represented as a json object. For example, the the node is in sane state but not allowed to accept new pods:
following conditions mean the node is reachable from its cluster, node is in
sane state but not allowed to accept new pods:
```json ```json
"conditions": [ "conditions": [
{
"kind": "Reachable",
"status": "True",
},
{ {
"kind": "Ready", "kind": "Ready",
"status": "True", "status": "True",
}, },
{ {
"kind": "Schedulable", "kind": "Schedulable",
"status": "False", "status": "False",

View File

@ -1069,9 +1069,7 @@ type NodeConditionType string
// node condition. In the future, we will add more. The proposed set of conditions are: // node condition. In the future, we will add more. The proposed set of conditions are:
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable. // NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.
const ( const (
// NodeReachable means the node can be reached (in the sense of HTTP connection) from node controller. // NodeReady means kubelet is healthy and ready to accept pods.
NodeReachable NodeConditionType = "Reachable"
// NodeReady means the node returns StatusOK for HTTP health check.
NodeReady NodeConditionType = "Ready" NodeReady NodeConditionType = "Ready"
// NodeSchedulable means the node is ready to accept new pods. // NodeSchedulable means the node is ready to accept new pods.
NodeSchedulable NodeConditionType = "Schedulable" NodeSchedulable NodeConditionType = "Schedulable"

View File

@ -1390,9 +1390,6 @@ func init() {
func(in *newer.NodeConditionType, out *NodeConditionKind, s conversion.Scope) error { func(in *newer.NodeConditionType, out *NodeConditionKind, s conversion.Scope) error {
switch *in { switch *in {
case newer.NodeReachable:
*out = NodeReachable
break
case newer.NodeReady: case newer.NodeReady:
*out = NodeReady *out = NodeReady
break break
@ -1406,9 +1403,6 @@ func init() {
}, },
func(in *NodeConditionKind, out *newer.NodeConditionType, s conversion.Scope) error { func(in *NodeConditionKind, out *newer.NodeConditionType, s conversion.Scope) error {
switch *in { switch *in {
case NodeReachable:
*out = newer.NodeReachable
break
case NodeReady: case NodeReady:
*out = newer.NodeReady *out = newer.NodeReady
break break

View File

@ -917,16 +917,16 @@ type NodeConditionKind string
// node condition. In the future, we will add more. The proposed set of conditions are: // node condition. In the future, we will add more. The proposed set of conditions are:
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable. // NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.
const ( const (
// NodeReachable means the node can be reached (in the sense of HTTP connection) from node controller. // NodeReachable means the node can be reached (in the sense of HTTP connection) within cluster.
NodeReachable NodeConditionKind = "Reachable" NodeReachable NodeConditionKind = "Reachable"
// NodeReady means the node returns StatusOK for HTTP health check. // NodeReady means kubelet is healthy and ready to accept pods.
NodeReady NodeConditionKind = "Ready" NodeReady NodeConditionKind = "Ready"
// NodeSchedulable means the node is ready to accept new pods. // NodeSchedulable means the node is ready to accept new pods.
NodeSchedulable NodeConditionKind = "Schedulable" NodeSchedulable NodeConditionKind = "Schedulable"
) )
type NodeCondition struct { type NodeCondition struct {
Kind NodeConditionKind `json:"kind" description:"kind of the condition, one of Reachable, Ready"` Kind NodeConditionKind `json:"kind" description:"kind of the condition, one of Reachable, Ready, Schedulable"`
Status ConditionStatus `json:"status" description:"status of the condition, one of Full, None, Unknown"` Status ConditionStatus `json:"status" description:"status of the condition, one of Full, None, Unknown"`
LastProbeTime util.Time `json:"lastProbeTime,omitempty" description:"last time the condition was probed"` LastProbeTime util.Time `json:"lastProbeTime,omitempty" description:"last time the condition was probed"`
LastTransitionTime util.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"` LastTransitionTime util.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"`

View File

@ -1317,9 +1317,6 @@ func init() {
func(in *newer.NodeConditionType, out *NodeConditionKind, s conversion.Scope) error { func(in *newer.NodeConditionType, out *NodeConditionKind, s conversion.Scope) error {
switch *in { switch *in {
case newer.NodeReachable:
*out = NodeReachable
break
case newer.NodeReady: case newer.NodeReady:
*out = NodeReady *out = NodeReady
break break
@ -1333,9 +1330,6 @@ func init() {
}, },
func(in *NodeConditionKind, out *newer.NodeConditionType, s conversion.Scope) error { func(in *NodeConditionKind, out *newer.NodeConditionType, s conversion.Scope) error {
switch *in { switch *in {
case NodeReachable:
*out = newer.NodeReachable
break
case NodeReady: case NodeReady:
*out = newer.NodeReady *out = newer.NodeReady
break break

View File

@ -926,9 +926,9 @@ type NodeConditionKind string
// node condition. In the future, we will add more. The proposed set of conditions are: // node condition. In the future, we will add more. The proposed set of conditions are:
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable. // NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.
const ( const (
// NodeReachable means the node can be reached (in the sense of HTTP connection) from node controller. // NodeReachable means the node can be reached (in the sense of HTTP connection) within cluster.
NodeReachable NodeConditionKind = "Reachable" NodeReachable NodeConditionKind = "Reachable"
// NodeReady means the node returns StatusOK for HTTP health check. // NodeReady means kubelet is healthy and ready to accept pods.
NodeReady NodeConditionKind = "Ready" NodeReady NodeConditionKind = "Ready"
// NodeSchedulable means the node is ready to accept new pods. // NodeSchedulable means the node is ready to accept new pods.
NodeSchedulable NodeConditionKind = "Schedulable" NodeSchedulable NodeConditionKind = "Schedulable"
@ -938,7 +938,7 @@ const (
// //
// https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/node.md#node-condition // https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/node.md#node-condition
type NodeCondition struct { type NodeCondition struct {
Kind NodeConditionKind `json:"kind" description:"kind of the condition, one of Reachable, Ready"` Kind NodeConditionKind `json:"kind" description:"kind of the condition, one of Reachable, Ready, Schedulable"`
Status ConditionStatus `json:"status" description:"status of the condition, one of Full, None, Unknown"` Status ConditionStatus `json:"status" description:"status of the condition, one of Full, None, Unknown"`
LastProbeTime util.Time `json:"lastProbeTime,omitempty" description:"last time the condition was probed"` LastProbeTime util.Time `json:"lastProbeTime,omitempty" description:"last time the condition was probed"`
LastTransitionTime util.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"` LastTransitionTime util.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"`

View File

@ -1066,16 +1066,14 @@ type NodeConditionType string
// node condition. In the future, we will add more. The proposed set of conditions are: // node condition. In the future, we will add more. The proposed set of conditions are:
// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable. // NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable.
const ( const (
// NodeReachable means the node can be reached (in the sense of HTTP connection) from node controller. // NodeReady means kubelet is healthy and ready to accept pods.
NodeReachable NodeConditionType = "Reachable"
// NodeReady means the node returns StatusOK for HTTP health check.
NodeReady NodeConditionType = "Ready" NodeReady NodeConditionType = "Ready"
// NodeSchedulable means the node is ready to accept new pods. // NodeSchedulable means the node is ready to accept new pods.
NodeSchedulable NodeConditionType = "Schedulable" NodeSchedulable NodeConditionType = "Schedulable"
) )
type NodeCondition struct { type NodeCondition struct {
Type NodeConditionType `json:"type" description:"type of node condition, one of Reachable, Ready"` Type NodeConditionType `json:"type" description:"type of node condition, one of Ready, Schedulable"`
Status ConditionStatus `json:"status" description:"status of the condition, one of Full, None, Unknown"` Status ConditionStatus `json:"status" description:"status of the condition, one of Full, None, Unknown"`
LastProbeTime util.Time `json:"lastProbeTime,omitempty" description:"last time the condition was probed"` LastProbeTime util.Time `json:"lastProbeTime,omitempty" description:"last time the condition was probed"`
LastTransitionTime util.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"` LastTransitionTime util.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"`

View File

@ -458,7 +458,7 @@ func printSecretList(list *api.SecretList, w io.Writer) error {
func printNode(node *api.Node, w io.Writer) error { func printNode(node *api.Node, w io.Writer) error {
conditionMap := make(map[api.NodeConditionType]*api.NodeCondition) conditionMap := make(map[api.NodeConditionType]*api.NodeCondition)
NodeAllConditions := []api.NodeConditionType{api.NodeSchedulable, api.NodeReady, api.NodeReachable} NodeAllConditions := []api.NodeConditionType{api.NodeSchedulable, api.NodeReady}
for i := range node.Status.Conditions { for i := range node.Status.Conditions {
cond := node.Status.Conditions[i] cond := node.Status.Conditions[i]
conditionMap[cond.Type] = &cond conditionMap[cond.Type] = &cond

View File

@ -549,15 +549,6 @@ func TestPrintMinionStatus(t *testing.T) {
}, },
status: "Ready", status: "Ready",
}, },
{
minion: api.Node{
ObjectMeta: api.ObjectMeta{Name: "foo2"},
Status: api.NodeStatus{Conditions: []api.NodeCondition{
{Type: api.NodeReady, Status: api.ConditionTrue},
{Type: api.NodeReachable, Status: api.ConditionTrue}}},
},
status: "Ready,Reachable",
},
{ {
minion: api.Node{ minion: api.Node{
ObjectMeta: api.ObjectMeta{Name: "foo3"}, ObjectMeta: api.ObjectMeta{Name: "foo3"},
@ -593,20 +584,18 @@ func TestPrintMinionStatus(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "foo7"}, ObjectMeta: api.ObjectMeta{Name: "foo7"},
Status: api.NodeStatus{Conditions: []api.NodeCondition{ Status: api.NodeStatus{Conditions: []api.NodeCondition{
{Type: api.NodeSchedulable, Status: api.ConditionTrue}, {Type: api.NodeSchedulable, Status: api.ConditionTrue},
{Type: api.NodeReady, Status: api.ConditionTrue}, {Type: api.NodeReady, Status: api.ConditionTrue}}},
{Type: api.NodeReachable, Status: api.ConditionTrue}}},
}, },
status: "Schedulable,Ready,Reachable", status: "Schedulable,Ready",
}, },
{ {
minion: api.Node{ minion: api.Node{
ObjectMeta: api.ObjectMeta{Name: "foo8"}, ObjectMeta: api.ObjectMeta{Name: "foo8"},
Status: api.NodeStatus{Conditions: []api.NodeCondition{ Status: api.NodeStatus{Conditions: []api.NodeCondition{
{Type: api.NodeSchedulable, Status: api.ConditionFalse}, {Type: api.NodeSchedulable, Status: api.ConditionFalse},
{Type: api.NodeReady, Status: api.ConditionFalse}, {Type: api.NodeReady, Status: api.ConditionFalse}}},
{Type: api.NodeReachable, Status: api.ConditionTrue}}},
}, },
status: "NotSchedulable,NotReady,Reachable", status: "NotSchedulable,NotReady",
}, },
} }

View File

@ -256,14 +256,10 @@ func (factory *ConfigFactory) pollMinions() (cache.Enumerator, error) {
if condition.Status == api.ConditionTrue { if condition.Status == api.ConditionTrue {
nodes.Items = append(nodes.Items, node) nodes.Items = append(nodes.Items, node)
} }
} else if condition, ok := conditionMap[api.NodeReachable]; ok {
if condition.Status == api.ConditionTrue {
nodes.Items = append(nodes.Items, node)
}
} else { } else {
// If no condition is set, we get unknown node condition. In such cases, // If no condition is set, we get unknown node condition. In such cases,
// do not add the node // do not add the node.
glog.V(2).Infof("Minion %s is not available. Skipping", node.Name) glog.V(2).Infof("Minion %s is not available. Skipping", node.Name)
} }
} }
return &nodeEnumerator{nodes}, nil return &nodeEnumerator{nodes}, nil

View File

@ -146,14 +146,6 @@ func TestPollMinions(t *testing.T) {
}, },
}, },
}, },
{
ObjectMeta: api.ObjectMeta{Name: "bar"},
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{Type: api.NodeReachable, Status: api.ConditionTrue},
},
},
},
{ {
ObjectMeta: api.ObjectMeta{Name: "fiz"}, ObjectMeta: api.ObjectMeta{Name: "fiz"},
Status: api.NodeStatus{ Status: api.NodeStatus{
@ -162,15 +154,6 @@ func TestPollMinions(t *testing.T) {
}, },
}, },
}, },
{
ObjectMeta: api.ObjectMeta{Name: "biz"},
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{Type: api.NodeReady, Status: api.ConditionTrue},
{Type: api.NodeReachable, Status: api.ConditionTrue},
},
},
},
{ {
ObjectMeta: api.ObjectMeta{Name: "baz"}, ObjectMeta: api.ObjectMeta{Name: "baz"},
Status: api.NodeStatus{ Status: api.NodeStatus{
@ -186,7 +169,6 @@ func TestPollMinions(t *testing.T) {
Conditions: []api.NodeCondition{ Conditions: []api.NodeCondition{
{Type: api.NodeSchedulable, Status: api.ConditionTrue}, {Type: api.NodeSchedulable, Status: api.ConditionTrue},
{Type: api.NodeReady, Status: api.ConditionTrue}, {Type: api.NodeReady, Status: api.ConditionTrue},
{Type: api.NodeReachable, Status: api.ConditionTrue},
}, },
}, },
}, },
@ -196,7 +178,6 @@ func TestPollMinions(t *testing.T) {
Conditions: []api.NodeCondition{ Conditions: []api.NodeCondition{
{Type: api.NodeSchedulable, Status: api.ConditionFalse}, {Type: api.NodeSchedulable, Status: api.ConditionFalse},
{Type: api.NodeReady, Status: api.ConditionTrue}, {Type: api.NodeReady, Status: api.ConditionTrue},
{Type: api.NodeReachable, Status: api.ConditionTrue},
}, },
}, },
}, },
@ -206,21 +187,11 @@ func TestPollMinions(t *testing.T) {
Conditions: []api.NodeCondition{ Conditions: []api.NodeCondition{
{Type: api.NodeSchedulable, Status: api.ConditionTrue}, {Type: api.NodeSchedulable, Status: api.ConditionTrue},
{Type: api.NodeReady, Status: api.ConditionFalse}, {Type: api.NodeReady, Status: api.ConditionFalse},
{Type: api.NodeReachable, Status: api.ConditionTrue},
},
},
},
{
ObjectMeta: api.ObjectMeta{Name: "fizbiz"},
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{Type: api.NodeSchedulable, Status: api.ConditionTrue},
{Type: api.NodeReachable, Status: api.ConditionFalse},
}, },
}, },
}, },
}, },
expectedCount: 5, expectedCount: 3,
}, },
{ {
minions: []api.Node{ minions: []api.Node{
@ -271,19 +242,6 @@ func TestPollMinions(t *testing.T) {
Status: api.NodeStatus{ Status: api.NodeStatus{
Conditions: []api.NodeCondition{ Conditions: []api.NodeCondition{
{Type: api.NodeReady, Status: api.ConditionTrue}, {Type: api.NodeReady, Status: api.ConditionTrue},
{Type: api.NodeReachable, Status: api.ConditionFalse}},
},
},
},
expectedCount: 1,
},
{
minions: []api.Node{
{
ObjectMeta: api.ObjectMeta{Name: "foo"},
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{Type: api.NodeReachable, Status: api.ConditionTrue},
{Type: "invalidValue", Status: api.ConditionFalse}}, {Type: "invalidValue", Status: api.ConditionFalse}},
}, },
}, },