Skip to content

Commit

Permalink
fix(reconciler): make sure to not update the original object
Browse files Browse the repository at this point in the history
If the original object contains a pointer, then without this patch that pointer will (inadvertently) change.

Co-authored-by: Dudás Ádám <[email protected]>
Signed-off-by: Szilard Parrag <[email protected]>
  • Loading branch information
OverOrion and siliconbrain committed Nov 20, 2023
1 parent 5c72338 commit 3e5b7d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/resources/model/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ func NewValidationReconciler(
continue
}

if err := repo.Status().Patch(ctx, req.Obj, req.Patch); err != nil {
obj := req.Obj.DeepCopyObject().(client.Object) // copy object so that the original is not changed by the call to Patch
if err := repo.Status().Patch(ctx, obj, req.Patch); err != nil {
errs = errors.Append(errs, err)
}
}
Expand Down

0 comments on commit 3e5b7d4

Please sign in to comment.