emit kube events for skipped and upgraded OSes
To provide better information to what the MCD is doing, the MCD should
emit an event whenever a MachineConfig specifies that a new OS will be
installed as well as whenever it does not.
@@ -379,6 +379,14 @@ func (dn *CoreOSDaemon) applyOSChanges(mcDiff machineConfigDiff, oldConfig, newC
MCDPivotErr.WithLabelValues(nodeName, newConfig.Spec.OSImageURL, err.Error()).SetToCurrentTime()
return err
}
+ if dn.nodeWriter != nil {
+ dn.nodeWriter.Eventf(corev1.EventTypeNormal, "OSUpgradeApplied", "OS upgrade applied; new MachineConfig (%s) has new OS image (%s)", newConfig.Name, newConfig.Spec.OSImageURL)
+ }
+ } else { //nolint:gocritic // The nil check for dn.nodeWriter has nothing to do with an OS update being unavailable.
+ // An OS upgrade is not available
+ if dn.nodeWriter != nil {
+ dn.nodeWriter.Eventf(corev1.EventTypeNormal, "OSUpgradeSkipped", "OS upgrade skipped; new MachineConfig (%s) has same OS image (%s) as old MachineConfig (%s)", newConfig.Name, newConfig.Spec.OSImageURL, oldConfig.Name)
+ }
}
defer func() {
