Commit 6bb97014 authored by Deyuan Deng's avatar Deyuan Deng Committed by Deyuan Deng

Remove Reachable Condition

parent b9babb56
......@@ -38,26 +38,20 @@ must have appropriate conditions, see below.
### Node Condition
Node Condition describes the conditions of `Running` nodes. Current valid
conditions are `NodeReachable`, `NodeReady` and `NodeSchedulable`. In the
future, we plan to add more. `NodeReachable` means the node can be reached
within the cluster. `NodeReady` means the kubelet returns StatusOK for HTTP
health check. `NodeSchedulable` means node is allowed to schedule any new
pods and is controlled by 'unschedulable' field in node spec.
Different condition provides different level of understanding for node
health. Kubernetes will make a comprehensive scheduling decision based on the
information. Node condition is represented as a json object. For example, the
following conditions mean the node is reachable from its cluster, node is in
sane state but not allowed to accept new pods:
conditions are `NodeReady` and `NodeSchedulable`. In the future, we plan to
add more. `NodeReady` means kubelet is healthy and ready to accept pods
`NodeSchedulable` means node is allowed to schedule any new pods and is
controlled by 'unschedulable' field in node spec. Different condition provides
different level of understanding for node health. Kubernetes will make a
comprehensive scheduling decision based on the information. Node condition
is represented as a json object. For example, the following conditions mean
the node is in sane state but not allowed to accept new pods:
```json
"conditions": [
{
"kind": "Reachable",
"status": "True",
},
{
"kind": "Ready",
"status": "True",
},
},
{
"kind": "Schedulable",
"status": "False",
......
......@@ -1069,9 +1069,7 @@ type NodeConditionType string
// 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 NodeConditionType = "Reachable"
// NodeReady means the node returns StatusOK for HTTP health check.
// NodeReady means kubelet is healthy and ready to accept pods.
NodeReady NodeConditionType = "Ready"
// NodeSchedulable means the node is ready to accept new pods.
NodeSchedulable NodeConditionType = "Schedulable"
......
......@@ -1390,9 +1390,6 @@ func init() {
func(in *newer.NodeConditionType, out *NodeConditionKind, s conversion.Scope) error {
switch *in {
case newer.NodeReachable:
*out = NodeReachable
break
case newer.NodeReady:
*out = NodeReady
break
......@@ -1406,9 +1403,6 @@ func init() {
},
func(in *NodeConditionKind, out *newer.NodeConditionType, s conversion.Scope) error {
switch *in {
case NodeReachable:
*out = newer.NodeReachable
break
case NodeReady:
*out = newer.NodeReady
break
......
......@@ -917,16 +917,16 @@ type NodeConditionKind string
// 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 means the node can be reached (in the sense of HTTP connection) within cluster.
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"
// NodeSchedulable means the node is ready to accept new pods.
NodeSchedulable NodeConditionKind = "Schedulable"
)
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"`
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"`
......
......@@ -1317,9 +1317,6 @@ func init() {
func(in *newer.NodeConditionType, out *NodeConditionKind, s conversion.Scope) error {
switch *in {
case newer.NodeReachable:
*out = NodeReachable
break
case newer.NodeReady:
*out = NodeReady
break
......@@ -1333,9 +1330,6 @@ func init() {
},
func(in *NodeConditionKind, out *newer.NodeConditionType, s conversion.Scope) error {
switch *in {
case NodeReachable:
*out = newer.NodeReachable
break
case NodeReady:
*out = newer.NodeReady
break
......
......@@ -926,9 +926,9 @@ type NodeConditionKind string
// 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 means the node can be reached (in the sense of HTTP connection) within cluster.
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"
// NodeSchedulable means the node is ready to accept new pods.
NodeSchedulable NodeConditionKind = "Schedulable"
......@@ -938,7 +938,7 @@ const (
//
// https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/node.md#node-condition
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"`
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"`
......
......@@ -1066,16 +1066,14 @@ type NodeConditionType string
// 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 NodeConditionType = "Reachable"
// NodeReady means the node returns StatusOK for HTTP health check.
// NodeReady means kubelet is healthy and ready to accept pods.
NodeReady NodeConditionType = "Ready"
// NodeSchedulable means the node is ready to accept new pods.
NodeSchedulable NodeConditionType = "Schedulable"
)
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"`
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"`
......
......@@ -458,7 +458,7 @@ func printSecretList(list *api.SecretList, w io.Writer) error {
func printNode(node *api.Node, w io.Writer) error {
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 {
cond := node.Status.Conditions[i]
conditionMap[cond.Type] = &cond
......
......@@ -551,15 +551,6 @@ func TestPrintMinionStatus(t *testing.T) {
},
{
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{
ObjectMeta: api.ObjectMeta{Name: "foo3"},
Status: api.NodeStatus{Conditions: []api.NodeCondition{
{Type: api.NodeReady, Status: api.ConditionTrue},
......@@ -593,20 +584,18 @@ func TestPrintMinionStatus(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "foo7"},
Status: api.NodeStatus{Conditions: []api.NodeCondition{
{Type: api.NodeSchedulable, Status: api.ConditionTrue},
{Type: api.NodeReady, Status: api.ConditionTrue},
{Type: api.NodeReachable, Status: api.ConditionTrue}}},
{Type: api.NodeReady, Status: api.ConditionTrue}}},
},
status: "Schedulable,Ready,Reachable",
status: "Schedulable,Ready",
},
{
minion: api.Node{
ObjectMeta: api.ObjectMeta{Name: "foo8"},
Status: api.NodeStatus{Conditions: []api.NodeCondition{
{Type: api.NodeSchedulable, Status: api.ConditionFalse},
{Type: api.NodeReady, Status: api.ConditionFalse},
{Type: api.NodeReachable, Status: api.ConditionTrue}}},
{Type: api.NodeReady, Status: api.ConditionFalse}}},
},
status: "NotSchedulable,NotReady,Reachable",
status: "NotSchedulable,NotReady",
},
}
......
......@@ -256,14 +256,10 @@ func (factory *ConfigFactory) pollMinions() (cache.Enumerator, error) {
if condition.Status == api.ConditionTrue {
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 {
// If no condition is set, we get unknown node condition. In such cases,
// do not add the node
glog.V(2).Infof("Minion %s is not available. Skipping", node.Name)
// do not add the node.
glog.V(2).Infof("Minion %s is not available. Skipping", node.Name)
}
}
return &nodeEnumerator{nodes}, nil
......
......@@ -147,14 +147,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"},
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
......@@ -163,15 +155,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"},
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
......@@ -186,7 +169,6 @@ func TestPollMinions(t *testing.T) {
Conditions: []api.NodeCondition{
{Type: api.NodeSchedulable, 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{
{Type: api.NodeSchedulable, Status: api.ConditionFalse},
{Type: api.NodeReady, Status: api.ConditionTrue},
{Type: api.NodeReachable, Status: api.ConditionTrue},
},
},
},
......@@ -206,21 +187,11 @@ func TestPollMinions(t *testing.T) {
Conditions: []api.NodeCondition{
{Type: api.NodeSchedulable, Status: api.ConditionTrue},
{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{
......@@ -271,19 +242,6 @@ func TestPollMinions(t *testing.T) {
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{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}},
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment