Skip to content

Commit

Permalink
Merge pull request #1234 from dtantsur/no-reconcile-hws
Browse files Browse the repository at this point in the history
🐛 Do not reconcile HostFirmwareSettings for detached hosts
  • Loading branch information
metal3-io-bot authored Mar 17, 2023
2 parents 2199328 + 7d68d41 commit bc6ca4b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions controllers/metal3.io/hostfirmwaresettings_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ func (r *HostFirmwareSettingsReconciler) Reconcile(ctx context.Context, req ctrl
return ctrl.Result{Requeue: true, RequeueAfter: resourceNotAvailableRetryDelay}, nil
}

if hasDetachedAnnotation(bmh) {
reqLogger.Info("the host is detached, not running reconciler")
return ctrl.Result{Requeue: true, RequeueAfter: unmanagedRetryDelay}, nil
}

// Fetch the HostFirmwareSettings
hfs := &metal3v1alpha1.HostFirmwareSettings{}
info := &rInfo{log: reqLogger, hfs: hfs, bmh: bmh}
Expand All @@ -147,7 +152,13 @@ func (r *HostFirmwareSettingsReconciler) Reconcile(ctx context.Context, req ctrl

ready, err := prov.IsReady()
if err != nil || !ready {
reqLogger.Info("provisioner is not ready", "RequeueAfter:", provisionerRetryDelay)
var msg string
if err == nil {
msg = "not ready"
} else {
msg = err.Error()
}
reqLogger.Info("provisioner is not ready", "Error", msg, "RequeueAfter", provisionerRetryDelay)
return ctrl.Result{Requeue: true, RequeueAfter: provisionerRetryDelay}, nil
}

Expand All @@ -156,7 +167,7 @@ func (r *HostFirmwareSettingsReconciler) Reconcile(ctx context.Context, req ctrl
// Get the current settings and schema, retry if provisioner returns error
currentSettings, schema, err := prov.GetFirmwareSettings(true)
if err != nil {
reqLogger.Info("provisioner returns error", "RequeueAfter:", provisionerRetryDelay)
reqLogger.Info("provisioner returns error", "Error", err.Error(), "RequeueAfter", provisionerRetryDelay)
return ctrl.Result{Requeue: true, RequeueAfter: provisionerRetryDelay}, nil
}

Expand Down

0 comments on commit bc6ca4b

Please sign in to comment.