@@ -622,7 +622,7 @@ func computeMachineDeployment(ctx context.Context, s *scope.Scope, machineDeploy
622622 currentObjectRef : currentBootstrapTemplateRef ,
623623 // Note: we are adding an ownerRef to Cluster so the template will be automatically garbage collected
624624 // in case of errors in between creating this template and creating/updating the MachineDeployment object
625- // with the reference to the ControlPlane object using this template.
625+ // with the reference to this template.
626626 ownerRef : ownerReferenceTo (s .Current .Cluster ),
627627 })
628628 if err != nil {
@@ -650,7 +650,7 @@ func computeMachineDeployment(ctx context.Context, s *scope.Scope, machineDeploy
650650 currentObjectRef : currentInfraMachineTemplateRef ,
651651 // Note: we are adding an ownerRef to Cluster so the template will be automatically garbage collected
652652 // in case of errors in between creating this template and creating/updating the MachineDeployment object
653- // with the reference to the ControlPlane object using this template.
653+ // with the reference to this template.
654654 ownerRef : ownerReferenceTo (s .Current .Cluster ),
655655 })
656656 if err != nil {
@@ -974,6 +974,10 @@ func computeMachinePool(_ context.Context, s *scope.Scope, machinePoolTopology c
974974 cluster : s .Current .Cluster ,
975975 nameGenerator : names .SimpleNameGenerator (bootstrapConfigNamePrefix (s .Current .Cluster .Name , machinePoolTopology .Name )),
976976 currentObjectRef : currentBootstrapConfigRef ,
977+ // Note: we are adding an ownerRef to Cluster so the template will be automatically garbage collected
978+ // in case of errors in between creating this template and creating/updating the MachinePool object
979+ // with the reference to this template.
980+ ownerRef : ownerReferenceTo (s .Current .Cluster ),
977981 })
978982 if err != nil {
979983 return nil , errors .Wrapf (err , "failed to compute bootstrap object for topology %q" , machinePoolTopology .Name )
@@ -998,6 +1002,10 @@ func computeMachinePool(_ context.Context, s *scope.Scope, machinePoolTopology c
9981002 cluster : s .Current .Cluster ,
9991003 nameGenerator : names .SimpleNameGenerator (infrastructureMachinePoolNamePrefix (s .Current .Cluster .Name , machinePoolTopology .Name )),
10001004 currentObjectRef : currentInfraMachinePoolRef ,
1005+ // Note: we are adding an ownerRef to Cluster so the template will be automatically garbage collected
1006+ // in case of errors in between creating this template and creating/updating the MachinePool object
1007+ // with the reference to this template.
1008+ ownerRef : ownerReferenceTo (s .Current .Cluster ),
10011009 })
10021010 if err != nil {
10031011 return nil , errors .Wrapf (err , "failed to compute infrastructure object for topology %q" , machinePoolTopology .Name )
0 commit comments