Skip to content

Commit a151cf9

Browse files
authored
Merge pull request kubernetes-sigs#9389 from sbueringer/pr-mp-add-ownerref
🌱 Add ownerRefs to BootstrapConfig/InfraMachinePool in classy Clusters
2 parents 51fd14e + e90bc0b commit a151cf9

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
@@ -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

Comments
 (0)