Skip to content

Commit

Permalink
Merge pull request #1821 from iurygregory/hfc-owner
Browse files Browse the repository at this point in the history
🌱 Use OwnerReference for HostFirmwareComponents
  • Loading branch information
metal3-io-bot authored Jul 9, 2024
2 parents 3d20976 + ca07ba3 commit 12df962
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions controllers/metal3.io/baremetalhost_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1794,8 +1794,8 @@ func (r *BareMetalHostReconciler) createHostFirmwareComponents(info *reconcileIn
Updates: []metal3api.FirmwareUpdate{}}

// Set bmh as owner, this makes sure the resource is deleted when bmh is deleted
if err = controllerutil.SetControllerReference(info.host, hfc, r.Scheme()); err != nil {
return errors.Wrap(err, "could not set bmh as controller for hostFirmwareComponents")
if err = controllerutil.SetOwnerReference(info.host, hfc, r.Scheme()); err != nil {
return errors.Wrap(err, "could not set bmh as owner for hostFirmwareComponents")
}
if err = r.Create(info.ctx, hfc); err != nil {
return errors.Wrap(err, "failure creating hostFirmwareComponents resource")
Expand All @@ -1810,8 +1810,8 @@ func (r *BareMetalHostReconciler) createHostFirmwareComponents(info *reconcileIn
// Necessary in case the CRD is created manually.

if !ownerReferenceExists(info.host, hfc) {
if err := controllerutil.SetControllerReference(info.host, hfc, r.Scheme()); err != nil {
return errors.Wrap(err, "could not set bmh as controller for hostFirmwareComponents")
if err := controllerutil.SetOwnerReference(info.host, hfc, r.Scheme()); err != nil {
return errors.Wrap(err, "could not set bmh as owner for hostFirmwareComponents")
}
if err := r.Update(info.ctx, hfc); err != nil {
return errors.Wrap(err, "failure updating hostFirmwareComponents resource")
Expand Down

0 comments on commit 12df962

Please sign in to comment.