Skip to content

Commit

Permalink
Ensure defaults and all resource mutation are considered before compa…
Browse files Browse the repository at this point in the history
…ring existing vs desired state of resources when reconciling updates, by dry-running the updates before (#356)
  • Loading branch information
guicassolato authored Dec 4, 2023
1 parent 2acf31b commit 1b6d635
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/reconcilers/base_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ func (b *BaseReconciler) ReconcileResource(ctx context.Context, obj, desired cli
return b.DeleteResource(ctx, desired)
}

desired.SetResourceVersion(obj.GetResourceVersion())
if err := b.Client().Update(ctx, desired, client.DryRunAll); err != nil {
return err
}

update, err := mutateFn(obj, desired)
if err != nil {
return err
Expand Down

0 comments on commit 1b6d635

Please sign in to comment.