From b0aa4a1f3bb85287063f4c6ab39a145df6e87bfa Mon Sep 17 00:00:00 2001 From: Seth Jennings Date: Fri, 2 Feb 2018 13:29:20 -0600 Subject: [PATCH] UPSTREAM: 59279: nodelifecycle: set OutOfDisk unknown on node timeout --- .../pkg/controller/node/node_controller.go | 1 + .../controller/node/nodecontroller_test.go | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/vendor/k8s.io/kubernetes/pkg/controller/node/node_controller.go b/vendor/k8s.io/kubernetes/pkg/controller/node/node_controller.go index ff77e6c7d5cd..20b760af8d5e 100644 --- a/vendor/k8s.io/kubernetes/pkg/controller/node/node_controller.go +++ b/vendor/k8s.io/kubernetes/pkg/controller/node/node_controller.go @@ -1033,6 +1033,7 @@ func (nc *Controller) tryUpdateNodeStatus(node *v1.Node) (time.Duration, v1.Node // remaining node conditions should also be set to Unknown remainingNodeConditionTypes := []v1.NodeConditionType{ + v1.NodeOutOfDisk, v1.NodeMemoryPressure, v1.NodeDiskPressure, // We don't change 'NodeNetworkUnavailable' condition, as it's managed on a control plane level. diff --git a/vendor/k8s.io/kubernetes/pkg/controller/node/nodecontroller_test.go b/vendor/k8s.io/kubernetes/pkg/controller/node/nodecontroller_test.go index a871dcbc6ef5..71e4754b24eb 100644 --- a/vendor/k8s.io/kubernetes/pkg/controller/node/nodecontroller_test.go +++ b/vendor/k8s.io/kubernetes/pkg/controller/node/nodecontroller_test.go @@ -1455,6 +1455,14 @@ func TestMonitorNodeStatusUpdateStatus(t *testing.T) { LastHeartbeatTime: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC), LastTransitionTime: fakeNow, }, + { + Type: v1.NodeOutOfDisk, + Status: v1.ConditionUnknown, + Reason: "NodeStatusNeverUpdated", + Message: "Kubelet never posted node status.", + LastHeartbeatTime: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC), + LastTransitionTime: fakeNow, + }, { Type: v1.NodeMemoryPressure, Status: v1.ConditionUnknown, @@ -1512,6 +1520,13 @@ func TestMonitorNodeStatusUpdateStatus(t *testing.T) { LastHeartbeatTime: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC), LastTransitionTime: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC), }, + { + Type: v1.NodeOutOfDisk, + Status: v1.ConditionFalse, + // Node status hasn't been updated for 1hr. + LastHeartbeatTime: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC), + LastTransitionTime: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC), + }, }, Capacity: v1.ResourceList{ v1.ResourceName(v1.ResourceCPU): resource.MustParse("10"), @@ -1536,6 +1551,13 @@ func TestMonitorNodeStatusUpdateStatus(t *testing.T) { LastHeartbeatTime: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC), LastTransitionTime: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC), }, + { + Type: v1.NodeOutOfDisk, + Status: v1.ConditionFalse, + // Node status hasn't been updated for 1hr. + LastHeartbeatTime: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC), + LastTransitionTime: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC), + }, }, Capacity: v1.ResourceList{ v1.ResourceName(v1.ResourceCPU): resource.MustParse("10"), @@ -1558,6 +1580,14 @@ func TestMonitorNodeStatusUpdateStatus(t *testing.T) { LastHeartbeatTime: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC), LastTransitionTime: metav1.Time{Time: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC).Add(time.Hour)}, }, + { + Type: v1.NodeOutOfDisk, + Status: v1.ConditionUnknown, + Reason: "NodeStatusUnknown", + Message: "Kubelet stopped posting node status.", + LastHeartbeatTime: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC), + LastTransitionTime: metav1.Time{Time: metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC).Add(time.Hour)}, + }, { Type: v1.NodeMemoryPressure, Status: v1.ConditionUnknown,