Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/controller/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const (

// MasterLabel defines the label associated with master node. The master taint uses the same label as taint's key
MasterLabel = "node-role.kubernetes.io/master"
// WorkerLabel defines the label associated with worker node.
WorkerLabel = "node-role.kubernetes.io/worker"

// MCNameSuffixAnnotationKey is used to keep track of the machine config name associated with a CR
MCNameSuffixAnnotationKey = "machineconfiguration.openshift.io/mc-name-suffix"
Expand Down
19 changes: 19 additions & 0 deletions pkg/daemon/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,25 @@ func (dn *Daemon) updateOnClusterLayering(oldConfig, newConfig *mcfgv1.MachineCo
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[ctrlcommon.MasterLabel]; ok {
pool = "master"
} else if _, ok = dn.node.Labels[ctrlcommon.WorkerLabel]; ok {
pool = "worker"
}
}
// update the MCN spec
mcnErr := upgrademonitor.GenerateAndApplyMachineConfigNodeSpec(dn.featureGatesAccessor, pool, dn.node, dn.mcfgClient)
if mcnErr != nil {
return fmt.Errorf("error updating MCN spec for node %s: %w", dn.node.Name, mcnErr)
}

oldIgnConfig, err := ctrlcommon.ParseAndConvertConfig(oldConfig.Spec.Config.Raw)
if err != nil {
return fmt.Errorf("parsing old Ignition config failed: %w", err)
Expand Down