fix outofdisk condition not reported

This commit is contained in:
David Ashpole 2017-08-03 13:44:31 -07:00
parent 1284d78c92
commit 177d64213c

View File

@ -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.