Skip to content

Commit e90bc0b

Browse files
committed
Add ownerRefs to BootstrapConfig/InfraMachinePool in classy Clusters
Signed-off-by: Stefan Büringer [email protected]
1 parent 58557b7 commit e90bc0b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

internal/controllers/topology/cluster/desired_state.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ func computeMachineDeployment(ctx context.Context, s *scope.Scope, machineDeploy
617617
currentObjectRef: currentBootstrapTemplateRef,
618618
// Note: we are adding an ownerRef to Cluster so the template will be automatically garbage collected
619619
// in case of errors in between creating this template and creating/updating the MachineDeployment object
620-
// with the reference to the ControlPlane object using this template.
620+
// with the reference to this template.
621621
ownerRef: ownerReferenceTo(s.Current.Cluster),
622622
})
623623

@@ -642,7 +642,7 @@ func computeMachineDeployment(ctx context.Context, s *scope.Scope, machineDeploy
642642
currentObjectRef: currentInfraMachineTemplateRef,
643643
// Note: we are adding an ownerRef to Cluster so the template will be automatically garbage collected
644644
// in case of errors in between creating this template and creating/updating the MachineDeployment object
645-
// with the reference to the ControlPlane object using this template.
645+
// with the reference to this template.
646646
ownerRef: ownerReferenceTo(s.Current.Cluster),
647647
})
648648

@@ -953,6 +953,10 @@ func computeMachinePool(_ context.Context, s *scope.Scope, machinePoolTopology c
953953
cluster: s.Current.Cluster,
954954
namePrefix: bootstrapConfigNamePrefix(s.Current.Cluster.Name, machinePoolTopology.Name),
955955
currentObjectRef: currentBootstrapConfigRef,
956+
// Note: we are adding an ownerRef to Cluster so the template will be automatically garbage collected
957+
// in case of errors in between creating this template and creating/updating the MachinePool object
958+
// with the reference to this template.
959+
ownerRef: ownerReferenceTo(s.Current.Cluster),
956960
})
957961
if err != nil {
958962
return nil, errors.Wrapf(err, "failed to compute bootstrap object for topology %q", machinePoolTopology.Name)
@@ -977,6 +981,10 @@ func computeMachinePool(_ context.Context, s *scope.Scope, machinePoolTopology c
977981
cluster: s.Current.Cluster,
978982
namePrefix: infrastructureMachinePoolNamePrefix(s.Current.Cluster.Name, machinePoolTopology.Name),
979983
currentObjectRef: currentInfraMachinePoolRef,
984+
// Note: we are adding an ownerRef to Cluster so the template will be automatically garbage collected
985+
// in case of errors in between creating this template and creating/updating the MachinePool object
986+
// with the reference to this template.
987+
ownerRef: ownerReferenceTo(s.Current.Cluster),
980988
})
981989
if err != nil {
982990
return nil, errors.Wrapf(err, "failed to compute infrastructure object for topology %q", machinePoolTopology.Name)

0 commit comments

Comments
 (0)