diff --git a/controllers/eventbus/controller.go b/controllers/eventbus/controller.go index caa1f5ffab..0a18f2060d 100644 --- a/controllers/eventbus/controller.go +++ b/controllers/eventbus/controller.go @@ -58,7 +58,8 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu log.Errorw("reconcile error", zap.Error(reconcileErr)) } if r.needsUpdate(eventBus, busCopy) { - if err := r.client.Update(ctx, busCopy); err != nil { + // Use a DeepCopy to update, because it will be mutated afterwards, with empty Status. + if err := r.client.Update(ctx, busCopy.DeepCopy()); err != nil { return reconcile.Result{}, err } } diff --git a/controllers/eventsource/controller.go b/controllers/eventsource/controller.go index 734a922204..c999e11099 100644 --- a/controllers/eventsource/controller.go +++ b/controllers/eventsource/controller.go @@ -55,7 +55,8 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu log.Errorw("reconcile error", zap.Error(reconcileErr)) } if r.needsUpdate(eventSource, esCopy) { - if err := r.client.Update(ctx, esCopy); err != nil { + // Use a DeepCopy to update, because it will be mutated afterwards, with empty Status. + if err := r.client.Update(ctx, esCopy.DeepCopy()); err != nil { return reconcile.Result{}, err } } diff --git a/controllers/sensor/controller.go b/controllers/sensor/controller.go index 07ccefca09..cb5421cd19 100644 --- a/controllers/sensor/controller.go +++ b/controllers/sensor/controller.go @@ -74,7 +74,8 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu log.Errorw("reconcile error", zap.Error(reconcileErr)) } if r.needsUpdate(sensor, sensorCopy) { - if err := r.client.Update(ctx, sensorCopy); err != nil { + // Use a DeepCopy to update, because it will be mutated afterwards, with empty Status. + if err := r.client.Update(ctx, sensorCopy.DeepCopy()); err != nil { return reconcile.Result{}, err } }