Skip to content

Commit

Permalink
TransportURL: rely on PatchInstance instead of manual Update
Browse files Browse the repository at this point in the history
The transporturl  controller did a separate client.Update after
it initialized it status then continued the normal reconciliation. As it
is explicitly updated the status subresource and no finalizer is added
this probably works. However to allow easier reasoning about when the
instance is updated this patch removes the explicit Update call and
instead returns immediately to use the deferred PatchInstance call
as the only place that persists the instance.
  • Loading branch information
gibizer committed Apr 25, 2024
1 parent 3266115 commit 77fda22
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions controllers/rabbitmq/transporturl_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,8 @@ func (r *TransportURLReconciler) Reconcile(ctx context.Context, req ctrl.Request
instance.Status.ObservedGeneration = instance.Generation

if isNewInstance {
// Register overall status immediately to have an early feedback e.g. in the cli
if err := r.Status().Update(ctx, instance); err != nil {
return ctrl.Result{}, err
}
// Return to register overall status immediately to have an early feedback e.g. in the cli
return ctrl.Result{}, nil
}

return r.reconcileNormal(ctx, instance, helper)
Expand Down

0 comments on commit 77fda22

Please sign in to comment.