Skip to content

Commit

Permalink
Set status.cond when cluster secret not found (#633)
Browse files Browse the repository at this point in the history
- previous error was only logger, with this commit status.condition
log and event are all updated
  • Loading branch information
ChunyiLyu authored Jun 9, 2023
1 parent 2c5e17f commit 85a0693
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions controllers/topology_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,17 @@ func (r *TopologyReconciler) handleRMQReferenceParseError(ctx context.Context, o
}
return ctrl.Result{}, nil
}

// set status condition and publish event for any other error
logger.Error(err, failedParseClusterRef)
msg := fmt.Sprintf("%s: %s", failedParseClusterRef, err.Error())
r.Recorder.Event(object, corev1.EventTypeWarning, "FailedCreateOrUpdate", msg)
object.SetStatusConditions([]topology.Condition{topology.NotReady(msg, r.getStatusConditions(object))})
if writerErr := clientretry.RetryOnConflict(clientretry.DefaultRetry, func() error {
return r.Status().Update(ctx, object)
}); writerErr != nil {
logger.Error(writerErr, failedStatusUpdate, "object", object.GetName())
}
return ctrl.Result{}, err
}

Expand Down

0 comments on commit 85a0693

Please sign in to comment.