Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Add ownerRefs to BootstrapConfig/InfraMachinePool in classy Clusters #9389

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -617,7 +617,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),
})

Expand All @@ -642,7 +642,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),
})

Expand Down Expand Up @@ -953,6 +953,10 @@ func computeMachinePool(_ context.Context, s *scope.Scope, machinePoolTopology c
cluster: s.Current.Cluster,
namePrefix: 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 @@ -977,6 +981,10 @@ func computeMachinePool(_ context.Context, s *scope.Scope, machinePoolTopology c
cluster: s.Current.Cluster,
namePrefix: 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