Skip to content

Commit

Permalink
Merge pull request #9389 from sbueringer/pr-mp-add-ownerref
Browse files Browse the repository at this point in the history
🌱 Add ownerRefs to BootstrapConfig/InfraMachinePool in classy Clusters
  • Loading branch information
k8s-ci-robot committed Sep 15, 2023
2 parents 51fd14e + e90bc0b commit a151cf9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/controllers/topology/cluster/desired_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ func computeMachineDeployment(ctx context.Context, s *scope.Scope, machineDeploy
currentObjectRef: currentBootstrapTemplateRef,
// Note: we are adding an ownerRef to Cluster so the template will be automatically garbage collected
// in case of errors in between creating this template and creating/updating the MachineDeployment object
// with the reference to the ControlPlane object using this template.
// with the reference to this template.
ownerRef: ownerReferenceTo(s.Current.Cluster),
})
if err != nil {
Expand Down Expand Up @@ -650,7 +650,7 @@ func computeMachineDeployment(ctx context.Context, s *scope.Scope, machineDeploy
currentObjectRef: currentInfraMachineTemplateRef,
// Note: we are adding an ownerRef to Cluster so the template will be automatically garbage collected
// in case of errors in between creating this template and creating/updating the MachineDeployment object
// with the reference to the ControlPlane object using this template.
// with the reference to this template.
ownerRef: ownerReferenceTo(s.Current.Cluster),
})
if err != nil {
Expand Down Expand Up @@ -974,6 +974,10 @@ func computeMachinePool(_ context.Context, s *scope.Scope, machinePoolTopology c
cluster: s.Current.Cluster,
nameGenerator: names.SimpleNameGenerator(bootstrapConfigNamePrefix(s.Current.Cluster.Name, machinePoolTopology.Name)),
currentObjectRef: currentBootstrapConfigRef,
// Note: we are adding an ownerRef to Cluster so the template will be automatically garbage collected
// in case of errors in between creating this template and creating/updating the MachinePool object
// with the reference to this template.
ownerRef: ownerReferenceTo(s.Current.Cluster),
})
if err != nil {
return nil, errors.Wrapf(err, "failed to compute bootstrap object for topology %q", machinePoolTopology.Name)
Expand All @@ -998,6 +1002,10 @@ func computeMachinePool(_ context.Context, s *scope.Scope, machinePoolTopology c
cluster: s.Current.Cluster,
nameGenerator: names.SimpleNameGenerator(infrastructureMachinePoolNamePrefix(s.Current.Cluster.Name, machinePoolTopology.Name)),
currentObjectRef: currentInfraMachinePoolRef,
// Note: we are adding an ownerRef to Cluster so the template will be automatically garbage collected
// in case of errors in between creating this template and creating/updating the MachinePool object
// with the reference to this template.
ownerRef: ownerReferenceTo(s.Current.Cluster),
})
if err != nil {
return nil, errors.Wrapf(err, "failed to compute infrastructure object for topology %q", machinePoolTopology.Name)
Expand Down

0 comments on commit a151cf9

Please sign in to comment.