@@ -996,6 +996,7 @@ func (r *MachineSetSyncReconciler) ensureMAPIMachineSetStatusUpdated(ctx context
996996}
997997
998998// setChangedCAPIMachineSetStatusFields sets the updated fields in the CAPI machine set status.
999+ // Note: ObservedGeneration is handled after calling this function.
9991000func setChangedCAPIMachineSetStatusFields (existingCAPIMachineSet , convertedCAPIMachineSet * clusterv1.MachineSet ) {
10001001 // convertedCAPIMachine holds the computed and desired status changes converted from the source MAPI machine, so apply them to the existing existingCAPIMachine.
10011002 // Merge the v1beta1 conditions.
@@ -1059,6 +1060,7 @@ func (r *MachineSetSyncReconciler) updateMAPIMachineSet(ctx context.Context, exi
10591060}
10601061
10611062// setChangedMAPIMachineSetStatusFields sets the updated fields in the MAPI machine set status.
1063+ // Note: ObservedGeneration is handled after calling this function.
10621064func setChangedMAPIMachineSetStatusFields (existingMAPIMachineSet , convertedMAPIMachineSet * mapiv1beta1.MachineSet ) {
10631065 // convertedMAPIMachineSet holds the computed and desired status changes, so apply them to the existing existingMAPIMachineSet.
10641066 existingMAPIMachineSet .Status .Replicas = convertedMAPIMachineSet .Status .Replicas
@@ -1068,9 +1070,20 @@ func setChangedMAPIMachineSetStatusFields(existingMAPIMachineSet, convertedMAPIM
10681070 existingMAPIMachineSet .Status .ErrorReason = convertedMAPIMachineSet .Status .ErrorReason
10691071 existingMAPIMachineSet .Status .ErrorMessage = convertedMAPIMachineSet .Status .ErrorMessage
10701072
1073+ // Merge the v1beta1 conditions.
10711074 for i := range convertedMAPIMachineSet .Status .Conditions {
10721075 existingMAPIMachineSet .Status .Conditions = util .SetMAPICondition (existingMAPIMachineSet .Status .Conditions , & convertedMAPIMachineSet .Status .Conditions [i ])
10731076 }
1077+
1078+ // Copy them back to the convertedMAPIMachineSet.
1079+ convertedMAPIMachineSet .Status .Conditions = existingMAPIMachineSet .Status .Conditions
1080+
1081+ // Keep the current SynchronizedGeneration and AuthorativeAPI. They get handled separately in `applySynchronizedConditionWithPatch`
1082+ convertedMAPIMachineSet .Status .SynchronizedGeneration = existingMAPIMachineSet .Status .SynchronizedGeneration
1083+ convertedMAPIMachineSet .Status .AuthoritativeAPI = existingMAPIMachineSet .Status .AuthoritativeAPI
1084+
1085+ // Finally overwrite the entire existingMAPIMachineSet status with the convertedMAPIMachineSet status.
1086+ existingMAPIMachineSet .Status = convertedMAPIMachineSet .Status
10741087}
10751088
10761089// ensureSyncFinalizer ensures the sync finalizer is present across mapi and capi machine sets.
0 commit comments