Skip to content

Commit

Permalink
Detect actual patching (#598)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Oct 9, 2024
1 parent 75fbb8d commit 82e25a7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,13 @@ func CreateOrPatch(ctx context.Context, c client.Client, obj client.Object, tran
return kutil.VerbUnchanged, err
}

assign(obj, mod)
return kutil.VerbPatched, nil
vt := kutil.VerbUnchanged
if obj.GetGeneration() != mod.GetGeneration() {
vt = kutil.VerbPatched
} else {
assign(obj, mod)
}
return vt, nil
}

func assign(target, src any) {
Expand Down

0 comments on commit 82e25a7

Please sign in to comment.