Skip to content

Commit e121461

Browse files
committed
OCPBUGS-53408: wait for build and ensure OS image is actually new
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 e121461

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
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

+6-10
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
@@ -2972,17 +2968,17 @@ func (dn *CoreOSDaemon) applyLayeredOSChanges(mcDiff machineConfigDiff, oldConfi
29722968
// if we're here, we've successfully pivoted, or pivoting wasn't necessary, so we reset the error gauge
29732969
mcdPivotErr.Set(0)
29742970

2975-
// If on-cluster layering is enabled, we can skip the rest of this process.
2976-
if mcDiff.oclEnabled {
2977-
return nil
2978-
}
2979-
29802971
if mcDiff.kargs {
29812972
if err := dn.updateKernelArguments(oldConfig.Spec.KernelArguments, newConfig.Spec.KernelArguments); err != nil {
29822973
return err
29832974
}
29842975
}
29852976

2977+
// If on-cluster layering is enabled, we can skip the rest of this process.
2978+
if mcDiff.oclEnabled {
2979+
return nil
2980+
}
2981+
29862982
// Switch to real time kernel
29872983
if mcDiff.osUpdate || mcDiff.kernelType {
29882984
if err := dn.switchKernel(oldConfig, newConfig); err != nil {

0 commit comments

Comments
 (0)