Skip to content

Commit

Permalink
do not mutate object state in the SpecChangePredicate
Browse files Browse the repository at this point in the history
  • Loading branch information
pepov committed Oct 21, 2020
1 parent e912066 commit 4253c2e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/reconciler/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ type SpecChangePredicate struct {
}

func (SpecChangePredicate) Update(e event.UpdateEvent) bool {
e.MetaNew.SetResourceVersion(e.MetaOld.GetResourceVersion())
oldRV := e.MetaOld.GetResourceVersion()
e.MetaOld.SetResourceVersion(e.MetaNew.GetResourceVersion())
defer e.MetaOld.SetResourceVersion(oldRV)

patchResult, err := patch.DefaultPatchMaker.Calculate(e.ObjectOld, e.ObjectNew, patch.IgnoreStatusFields(), IgnoreManagedFields())
if err != nil {
return true
Expand Down

0 comments on commit 4253c2e

Please sign in to comment.