diff --git a/pkg/daemon/update.go b/pkg/daemon/update.go index 7546995f6f..6e5b8a2131 100644 --- a/pkg/daemon/update.go +++ b/pkg/daemon/update.go @@ -837,6 +837,25 @@ func (dn *Daemon) updateOnClusterBuild(oldConfig, newConfig *mcfgv1.MachineConfi oldConfigName := oldConfig.GetName() newConfigName := newConfig.GetName() + // Add the desired config version to the MCN + // get MCP associated with node. Note that in 4.18 and prior only default worker + // & master node roles/MCPs are supported in MCN, thus the hard-coded label checks + // for determining MCP association. + pool := "" + var ok bool + if dn.node != nil { + if _, ok = dn.node.Labels["node-role.kubernetes.io/master"]; ok { + pool = "master" + } else if _, ok = dn.node.Labels["node-role.kubernetes.io/worker"]; ok { + pool = "worker" + } + } + // update the MCN spec + err := upgrademonitor.GenerateAndApplyMachineConfigNodeSpec(dn.featureGatesAccessor, pool, dn.node, dn.mcfgClient) + if err != nil { + return fmt.Errorf("error updating MCN spec for node %s: %w", dn.node.Name, err) + } + oldIgnConfig, err := ctrlcommon.ParseAndConvertConfig(oldConfig.Spec.Config.Raw) if err != nil { return fmt.Errorf("parsing old Ignition config failed: %w", err)