Skip to content

Commit b635f0b

Browse files
committed
Revert "always create, because we delete the infra machine to repopulate spec on changes"
This reverts commit fb4132d.
1 parent fb4132d commit b635f0b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/controllers/machinesync/machine_sync_controller.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,10 @@ func (r *MachineSyncReconciler) Reconcile(ctx context.Context, req reconcile.Req
266266
case authoritativeAPI == mapiv1beta1.MachineAuthorityMachineAPI:
267267
return r.reconcileMAPIMachinetoCAPIMachine(ctx, mapiMachine, capiMachine)
268268
case authoritativeAPI == mapiv1beta1.MachineAuthorityClusterAPI && !capiMachineNotFound:
269-
// Create Cluster API Infrastructure Machine from MAPI if it doesn't exist, no deletion is in progress and.
270-
// the CAPI machine is not marked for deletion.
271-
if !capiInfraMachineExists && capiMachine.DeletionTimestamp.IsZero() && mapiMachine.DeletionTimestamp.IsZero() {
269+
// Create Cluster API Infrastructure Machine from MAPI if it doesn't exist and no deletion is in progress.
270+
// the CAPI machine is not marked for deletion and the MAPI machine was created before the Cluster API machine.
271+
if capiMachine.DeletionTimestamp.IsZero() && mapiMachine.DeletionTimestamp.IsZero() &&
272+
!capiInfraMachineExists && !mapiMachine.CreationTimestamp.After(capiMachine.CreationTimestamp.Time) {
272273
return r.reconcileMAPIMachinetoCAPIMachine(ctx, mapiMachine, capiMachine)
273274
}
274275

0 commit comments

Comments
 (0)