Skip to content

Commit cab64f7

Browse files
committed
OCPBUGS-53408: wait for build ensure OS image is not the same
Occasionally, there is a delay between the time that a new rendered MachineConfig is produced and OCL begins a build. However, a couple of things happen in the interim: - The RenderController updates the MachineConfigPool. Because of the delay mentioned above, the NodeController begins updating all of the nodes with only the new rendered MachineConfig. The OS image remains the same because the NodeController is not ensuring that the image pullspec on the MachineOSConfig is the same as the MachineOSBuild. - Because of the work done to the MCD in #4825, the original check that we had to determine whether the image pullspecs were the same is no longer present. Additionally, the logic change there makes it possible for an OS update to always occur whenever OCL is enabled, further bypassing that check. This fixes that by doing two things: 1. Update the Node Controller to ensure that the both the MachineOSBuild's MachineConfig reference matches the MCP's current rendered MachineConfig while also checking that the MachineOSConfig's image pullspec matches the MachineOSBuild's. In the situation where the MachineOSBuild's pullspec is empty, this check will fail and the Node Controller will requeue. 2. Update the MCD so that even when OCL is enabled, if the OS images are the same, the OS update process is skipped.
1 parent 1bffe82 commit cab64f7

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

pkg/controller/node/node_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ func (ctrl *Controller) GetConfigAndBuild(pool *mcfgv1.MachineConfigPool) (*mcfg
915915

916916
for _, build := range buildList.Items {
917917
if build.Spec.MachineOSConfig.Name == ourConfig.Name {
918-
if build.Spec.MachineConfig.Name == pool.Spec.Configuration.Name {
918+
if build.Spec.MachineConfig.Name == pool.Spec.Configuration.Name && ourConfig.Status.CurrentImagePullSpec == build.Status.DigestedImagePushSpec {
919919
ourBuild = &build
920920
break
921921
}

pkg/daemon/update.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -2895,10 +2895,6 @@ func (dn *CoreOSDaemon) applyLayeredOSChanges(mcDiff machineConfigDiff, oldConfi
28952895
if mcDiff.osUpdate && dn.bootedOSImageURL == newConfig.Spec.OSImageURL {
28962896
klog.Infof("Already in desired image %s", newConfig.Spec.OSImageURL)
28972897
mcDiff.osUpdate = false
2898-
// If OCL is enabled, return early here since there is nothing else to do.
2899-
if mcDiff.oclEnabled {
2900-
return nil
2901-
}
29022898
}
29032899

29042900
var osExtensionsContentDir string
@@ -2954,7 +2950,7 @@ func (dn *CoreOSDaemon) applyLayeredOSChanges(mcDiff machineConfigDiff, oldConfi
29542950
}
29552951

29562952
// Update OS
2957-
if mcDiff.osUpdate || mcDiff.oclEnabled {
2953+
if mcDiff.osUpdate {
29582954
if err := dn.updateLayeredOS(newConfig); err != nil {
29592955
mcdPivotErr.Inc()
29602956
return err

0 commit comments

Comments
 (0)