mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
node: move the reboot detection logic to kubelet
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
This commit is contained in:
parent
604e0ad328
commit
fe2d1f6762
@ -294,16 +294,6 @@ func (nc *NodeController) populateNodeInfo(node *api.Node) error {
|
|||||||
for key, value := range nodeInfo.Capacity {
|
for key, value := range nodeInfo.Capacity {
|
||||||
node.Status.Capacity[key] = value
|
node.Status.Capacity[key] = value
|
||||||
}
|
}
|
||||||
if node.Status.NodeInfo.BootID != "" &&
|
|
||||||
node.Status.NodeInfo.BootID != nodeInfo.NodeSystemInfo.BootID {
|
|
||||||
ref := &api.ObjectReference{
|
|
||||||
Kind: "Minion",
|
|
||||||
Name: node.Name,
|
|
||||||
UID: node.UID,
|
|
||||||
Namespace: api.NamespaceDefault,
|
|
||||||
}
|
|
||||||
nc.recorder.Eventf(ref, "rebooted", "Node %s has been rebooted", node.Name)
|
|
||||||
}
|
|
||||||
node.Status.NodeInfo = nodeInfo.NodeSystemInfo
|
node.Status.NodeInfo = nodeInfo.NodeSystemInfo
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1752,8 +1752,15 @@ func (kl *Kubelet) tryUpdateNodeStatus() error {
|
|||||||
} else {
|
} else {
|
||||||
node.Status.NodeInfo.MachineID = info.MachineID
|
node.Status.NodeInfo.MachineID = info.MachineID
|
||||||
node.Status.NodeInfo.SystemUUID = info.SystemUUID
|
node.Status.NodeInfo.SystemUUID = info.SystemUUID
|
||||||
node.Status.NodeInfo.BootID = info.BootID
|
|
||||||
node.Status.Capacity = CapacityFromMachineInfo(info)
|
node.Status.Capacity = CapacityFromMachineInfo(info)
|
||||||
|
if node.Status.NodeInfo.BootID != "" &&
|
||||||
|
node.Status.NodeInfo.BootID != info.BootID {
|
||||||
|
// 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.getNodeReference(), "rebooted",
|
||||||
|
"Node %s has been rebooted, boot id: %s", kl.hostname, info.BootID)
|
||||||
|
}
|
||||||
|
node.Status.NodeInfo.BootID = info.BootID
|
||||||
}
|
}
|
||||||
|
|
||||||
currentTime := util.Now()
|
currentTime := util.Now()
|
||||||
|
Loading…
Reference in New Issue
Block a user