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

🌱 Added Error message when reconciling loop is triggered more than once #2083

Merged
Show file tree
Hide file tree
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
14 changes: 9 additions & 5 deletions controllers/metal3.io/baremetalhost_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const (
subResourceNotReadyRetryDelay = time.Second * 60
clarifySoftPoweroffFailure = "Continuing with hard poweroff after soft poweroff fails. More details: "
hardwareDataFinalizer = metal3api.BareMetalHostFinalizer + "/hardwareData"
NotReady = "Not ready"
)

// BareMetalHostReconciler reconciles a BareMetalHost object.
Expand Down Expand Up @@ -212,12 +213,15 @@ func (r *BareMetalHostReconciler) Reconcile(ctx context.Context, request ctrl.Re
}

ready, err := prov.TryInit()
if err != nil {
return ctrl.Result{}, errors.Wrap(err, "failed to check services availability")
}
if !ready {
if err != nil || !ready {
var msg string
if err == nil {
msg = NotReady
} else {
msg = err.Error()
}
provisionerNotReady.Inc()
reqLogger.Info("provisioner is not ready", "RequeueAfter:", provisionerNotReadyRetryDelay)
reqLogger.Info("provisioner is not ready", "Error:", msg, "RequeueAfter:", provisionerNotReadyRetryDelay)
return ctrl.Result{Requeue: true, RequeueAfter: provisionerNotReadyRetryDelay}, nil
}

Expand Down
28 changes: 16 additions & 12 deletions controllers/metal3.io/bmceventsubscription_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,14 @@ func (r *BMCEventSubscriptionReconciler) Reconcile(ctx context.Context, request

prov, ready, err := r.getProvisioner(ctx, request, host)

if err != nil {
return ctrl.Result{}, errors.Wrap(err, "failed to create provisioner")
}

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

Expand Down Expand Up @@ -220,12 +222,14 @@ func (r *BMCEventSubscriptionReconciler) getProvisioner(ctx context.Context, req
}

ready, err = prov.TryInit()
if err != nil {
return prov, ready, errors.Wrap(err, "failed to check services availability")
}

if !ready {
reqLogger.Info("provisioner is not ready", "RequeueAfter:", provisionerNotReadyRetryDelay)
if err != nil || !ready {
var msg string
if err == nil {
msg = NotReady
} else {
msg = err.Error()
}
reqLogger.Info("provisioner is not ready", "Error:", msg, "RequeueAfter:", provisionerNotReadyRetryDelay)
return prov, ready, nil
}

Expand Down