Skip to content

Commit 62f36dd

Browse files
djoshyopenshift-cherrypick-robot
authored and
openshift-cherrypick-robot
committed
daemon: clarify OSUpdate events
1 parent 28740b6 commit 62f36dd

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

pkg/daemon/update.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,20 +521,26 @@ func (dn *CoreOSDaemon) applyOSChanges(mcDiff machineConfigDiff, oldConfig, newC
521521

522522
// Only check the image type and execute OS changes if:
523523
// - machineconfig changed
524-
// - we're staying on a realtime kernel ( need to run rpm-ostree update )
525-
// - we have extensions ( need to run rpm-ostree update )
524+
// - we're staying on a realtime/64k kernel ( need to run rpm-ostree update )
525+
// - we have a diff in extensions ( need to run rpm-ostree update )
526526
// We have at least one customer that removes the pull secret from the cluster to "shrinkwrap" it for distribution and we want
527527
// to make sure we don't break that use case, but realtime kernel update and extensions update always ran
528528
// if they were in use, so we also need to preserve that behavior.
529529
// https://issues.redhat.com/browse/OCPBUGS-4049
530530
if mcDiff.osUpdate || mcDiff.extensions || mcDiff.kernelType || mcDiff.kargs ||
531531
canonicalizeKernelType(newConfig.Spec.KernelType) == ctrlcommon.KernelTypeRealtime ||
532-
canonicalizeKernelType(newConfig.Spec.KernelType) == ctrlcommon.KernelType64kPages ||
533-
len(newConfig.Spec.Extensions) > 0 {
532+
canonicalizeKernelType(newConfig.Spec.KernelType) == ctrlcommon.KernelType64kPages {
534533

535534
// Throw started/staged events only if there is any update required for the OS
536535
if dn.nodeWriter != nil {
537-
dn.nodeWriter.Eventf(corev1.EventTypeNormal, "OSUpdateStarted", mcDiff.osChangesString())
536+
reason := mcDiff.osChangesString()
537+
if reason == "" {
538+
// osChangesString() can return empty in cases where the above diffs are false,
539+
// but the node uses a non standard kernel, so let's make it a bit more
540+
// informative in such cases
541+
reason = fmt.Sprintf("Updating to a target config with %s kernel", canonicalizeKernelType(newConfig.Spec.KernelType))
542+
}
543+
dn.nodeWriter.Eventf(corev1.EventTypeNormal, "OSUpdateStarted", reason)
538544
}
539545

540546
if err := dn.applyLayeredOSChanges(mcDiff, oldConfig, newConfig); err != nil {

0 commit comments

Comments
 (0)