mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-29 21:29:24 +00:00
Remove ConditionSchedulable
This commit is contained in:
@@ -339,12 +339,6 @@ func (nc *NodeController) DoCheck(node *api.Node) []api.NodeCondition {
|
||||
}
|
||||
conditions = append(conditions, *newReadyCondition)
|
||||
|
||||
// Check Condition: NodeSchedulable
|
||||
oldSchedulableCondition := nc.getCondition(&node.Status, api.NodeSchedulable)
|
||||
newSchedulableCondition := nc.checkNodeSchedulable(node)
|
||||
nc.updateLastTransitionTime(oldSchedulableCondition, newSchedulableCondition)
|
||||
conditions = append(conditions, *newSchedulableCondition)
|
||||
|
||||
return conditions
|
||||
}
|
||||
|
||||
@@ -360,25 +354,6 @@ func (nc *NodeController) updateLastTransitionTime(oldCondition, newCondition *a
|
||||
}
|
||||
}
|
||||
|
||||
// checkNodeSchedulable checks node schedulable condition, without transition timestamp set.
|
||||
func (nc *NodeController) checkNodeSchedulable(node *api.Node) *api.NodeCondition {
|
||||
if node.Spec.Unschedulable {
|
||||
return &api.NodeCondition{
|
||||
Type: api.NodeSchedulable,
|
||||
Status: api.ConditionFalse,
|
||||
Reason: "User marked unschedulable during node create/update",
|
||||
LastProbeTime: nc.now(),
|
||||
}
|
||||
} else {
|
||||
return &api.NodeCondition{
|
||||
Type: api.NodeSchedulable,
|
||||
Status: api.ConditionTrue,
|
||||
Reason: "Node is schedulable by default",
|
||||
LastProbeTime: nc.now(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// checkNodeReady checks raw node ready condition, without transition timestamp set.
|
||||
func (nc *NodeController) checkNodeReady(node *api.Node) *api.NodeCondition {
|
||||
switch status, err := nc.kubeletClient.HealthCheck(node.Name); {
|
||||
|
||||
@@ -625,13 +625,6 @@ func TestNodeConditionsCheck(t *testing.T) {
|
||||
LastProbeTime: fakeNow,
|
||||
LastTransitionTime: fakeNow,
|
||||
},
|
||||
{
|
||||
Type: api.NodeSchedulable,
|
||||
Status: api.ConditionTrue,
|
||||
Reason: "Node is schedulable by default",
|
||||
LastProbeTime: fakeNow,
|
||||
LastTransitionTime: fakeNow,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -650,18 +643,10 @@ func TestNodeConditionsCheck(t *testing.T) {
|
||||
LastProbeTime: fakeNow,
|
||||
LastTransitionTime: fakeNow,
|
||||
},
|
||||
{
|
||||
Type: api.NodeSchedulable,
|
||||
Status: api.ConditionTrue,
|
||||
Reason: "Node is schedulable by default",
|
||||
LastProbeTime: fakeNow,
|
||||
LastTransitionTime: fakeNow,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
// User specified node as unschedulable and kubelet /healthz probe returns failure with some error.
|
||||
// Expected node condition to be not ready and marked unschedulable.
|
||||
// Expected node condition to be not ready as marking Node Unschedulable does not impact Readiness.
|
||||
node: &api.Node{ObjectMeta: api.ObjectMeta{Name: "node0"}, Spec: api.NodeSpec{Unschedulable: true}},
|
||||
fakeKubeletClient: &FakeKubeletClient{
|
||||
Status: probe.Failure,
|
||||
@@ -675,13 +660,6 @@ func TestNodeConditionsCheck(t *testing.T) {
|
||||
LastProbeTime: fakeNow,
|
||||
LastTransitionTime: fakeNow,
|
||||
},
|
||||
{
|
||||
Type: api.NodeSchedulable,
|
||||
Status: api.ConditionFalse,
|
||||
Reason: "User marked unschedulable during node create/update",
|
||||
LastProbeTime: fakeNow,
|
||||
LastTransitionTime: fakeNow,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -764,13 +742,6 @@ func TestSyncProbedNodeStatus(t *testing.T) {
|
||||
LastProbeTime: fakeNow,
|
||||
LastTransitionTime: fakeNow,
|
||||
},
|
||||
{
|
||||
Type: api.NodeSchedulable,
|
||||
Status: api.ConditionTrue,
|
||||
Reason: "Node is schedulable by default",
|
||||
LastProbeTime: fakeNow,
|
||||
LastTransitionTime: fakeNow,
|
||||
},
|
||||
},
|
||||
Addresses: []api.NodeAddress{
|
||||
{Type: api.NodeLegacyHostIP, Address: "1.2.3.4"},
|
||||
@@ -795,13 +766,6 @@ func TestSyncProbedNodeStatus(t *testing.T) {
|
||||
LastProbeTime: fakeNow,
|
||||
LastTransitionTime: fakeNow,
|
||||
},
|
||||
{
|
||||
Type: api.NodeSchedulable,
|
||||
Status: api.ConditionTrue,
|
||||
Reason: "Node is schedulable by default",
|
||||
LastProbeTime: fakeNow,
|
||||
LastTransitionTime: fakeNow,
|
||||
},
|
||||
},
|
||||
Addresses: []api.NodeAddress{
|
||||
{Type: api.NodeLegacyHostIP, Address: "1.2.3.4"},
|
||||
@@ -868,12 +832,6 @@ func TestSyncProbedNodeStatusTransitionTime(t *testing.T) {
|
||||
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.ConditionTrue,
|
||||
Reason: "Node is schedulable by default",
|
||||
LastTransitionTime: util.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -903,12 +861,6 @@ func TestSyncProbedNodeStatusTransitionTime(t *testing.T) {
|
||||
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.ConditionTrue,
|
||||
Reason: "Node is schedulable by default",
|
||||
LastTransitionTime: util.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user