@@ -917,6 +917,10 @@ func (r *MachineSyncReconciler) convertMAPIMachineOwnerReferencesToCAPI(ctx cont
917917func (r * MachineSyncReconciler ) convertCAPIMachineOwnerReferencesToMAPI (ctx context.Context , capiMachine * clusterv1.Machine ) ([]metav1.OwnerReference , error ) {
918918 mapiOwnerReferences := []metav1.OwnerReference {}
919919
920+ if capiMachine .OwnerReferences == nil {
921+ return nil , nil
922+ }
923+
920924 if len (capiMachine .OwnerReferences ) == 0 {
921925 return mapiOwnerReferences , nil
922926 }
@@ -964,7 +968,7 @@ func (r *MachineSyncReconciler) convertCAPIMachineOwnerReferencesToMAPI(ctx cont
964968 }
965969
966970 // MAPI doesn't have a cluster, so we don't need to add an owner reference.
967- return mapiOwnerReferences , nil
971+ return nil , nil
968972 default :
969973 return nil , field .Invalid (field .NewPath ("metadata" , "ownerReferences" ), capiMachine .OwnerReferences , errUnsuportedOwnerKindForConversion .Error ())
970974 }
@@ -1296,7 +1300,7 @@ func compareMAPIMachines(a, b *machinev1beta1.Machine) (map[string]any, error) {
12961300 return nil , fmt .Errorf ("unable to parse first Machine API machine set providerSpec: %w" , err )
12971301 }
12981302
1299- ps2 , err := mapi2capi .AWSProviderSpecFromRawExtension (a .Spec .ProviderSpec .Value )
1303+ ps2 , err := mapi2capi .AWSProviderSpecFromRawExtension (b .Spec .ProviderSpec .Value )
13001304 if err != nil {
13011305 return nil , fmt .Errorf ("unable to parse second Machine API machine set providerSpec: %w" , err )
13021306 }
0 commit comments