nodecontroller: improve node status event recording
This patch substitutes the misleading reason "unknown" for the event recording. For symmetry with kubelet's message "online" the conditions Unknown and False are reported as "offline". Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
This commit is contained in:
@@ -1717,22 +1717,11 @@ func (kl *Kubelet) updateNodeStatus() error {
|
||||
return fmt.Errorf("Update node status exceeds retry count")
|
||||
}
|
||||
|
||||
func (kl *Kubelet) recordNodeOnlineEvent() {
|
||||
func (kl *Kubelet) recordNodeStatusEvent(event string) {
|
||||
glog.V(2).Infof("Recording %s event message for node %s", event, kl.hostname)
|
||||
// TODO: This requires a transaction, either both node status is updated
|
||||
// and event is recorded or neither should happen, see issue #6055.
|
||||
kl.recorder.Eventf(kl.nodeRef, "online", "Node %s is now online", kl.hostname)
|
||||
}
|
||||
|
||||
func (kl *Kubelet) recordNodeSchedulableEvent() {
|
||||
// TODO: This requires a transaction, either both node status is updated
|
||||
// and event is recorded or neither should happen, see issue #6055.
|
||||
kl.recorder.Eventf(kl.nodeRef, "schedulable", "Node %s is now schedulable", kl.hostname)
|
||||
}
|
||||
|
||||
func (kl *Kubelet) recordNodeUnschedulableEvent() {
|
||||
// TODO: This requires a transaction, either both node status is updated
|
||||
// and event is recorded or neither should happen, see issue #6055.
|
||||
kl.recorder.Eventf(kl.nodeRef, "unschedulable", "Node %s is now unschedulable", kl.hostname)
|
||||
kl.recorder.Eventf(kl.nodeRef, event, "Node %s status is now: %s", kl.hostname, event)
|
||||
}
|
||||
|
||||
// Maintains Node.Spec.Unschedulable value from previous run of tryUpdateNodeStatus()
|
||||
@@ -1828,7 +1817,7 @@ func (kl *Kubelet) tryUpdateNodeStatus() error {
|
||||
if node.Status.Conditions[i].Type == api.NodeReady {
|
||||
newCondition.LastTransitionTime = node.Status.Conditions[i].LastTransitionTime
|
||||
if node.Status.Conditions[i].Status != api.ConditionTrue {
|
||||
kl.recordNodeOnlineEvent()
|
||||
kl.recordNodeStatusEvent("NodeReady")
|
||||
}
|
||||
node.Status.Conditions[i] = newCondition
|
||||
updated = true
|
||||
@@ -1837,14 +1826,14 @@ func (kl *Kubelet) tryUpdateNodeStatus() error {
|
||||
if !updated {
|
||||
newCondition.LastTransitionTime = currentTime
|
||||
node.Status.Conditions = append(node.Status.Conditions, newCondition)
|
||||
kl.recordNodeOnlineEvent()
|
||||
kl.recordNodeStatusEvent("NodeReady")
|
||||
}
|
||||
|
||||
if oldNodeUnschedulable != node.Spec.Unschedulable {
|
||||
if node.Spec.Unschedulable {
|
||||
kl.recordNodeUnschedulableEvent()
|
||||
kl.recordNodeStatusEvent("NodeNotSchedulable")
|
||||
} else {
|
||||
kl.recordNodeSchedulableEvent()
|
||||
kl.recordNodeStatusEvent("NodeSchedulable")
|
||||
}
|
||||
oldNodeUnschedulable = node.Spec.Unschedulable
|
||||
}
|
||||
|
Reference in New Issue
Block a user