From 177d64213ce339a41a548b19211d96d104c6cdc4 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 3 Aug 2017 13:44:31 -0700 Subject: [PATCH] fix outofdisk condition not reported --- pkg/kubelet/kubelet_node_status.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkg/kubelet/kubelet_node_status.go b/pkg/kubelet/kubelet_node_status.go index ecc3fb2ee4a..702157aa892 100644 --- a/pkg/kubelet/kubelet_node_status.go +++ b/pkg/kubelet/kubelet_node_status.go @@ -865,14 +865,16 @@ func (kl *Kubelet) setNodeOODCondition(node *v1.Node) { } newOODCondition := nodeOODCondition == nil - if newOODCondition || nodeOODCondition.Status == v1.ConditionUnknown { - nodeOODCondition = &v1.NodeCondition{ - Type: v1.NodeOutOfDisk, - Status: v1.ConditionFalse, - Reason: "KubeletHasSufficientDisk", - Message: "kubelet has sufficient disk space available", - LastTransitionTime: currentTime, - } + if newOODCondition { + nodeOODCondition = &v1.NodeCondition{} + } + if nodeOODCondition.Status != v1.ConditionFalse { + nodeOODCondition.Type = v1.NodeOutOfDisk + nodeOODCondition.Status = v1.ConditionFalse + nodeOODCondition.Reason = "KubeletHasSufficientDisk" + nodeOODCondition.Message = "kubelet has sufficient disk space available" + nodeOODCondition.LastTransitionTime = currentTime + kl.recordNodeStatusEvent(v1.EventTypeNormal, "NodeHasSufficientDisk") } // Update the heartbeat time irrespective of all the conditions.