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 <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Oct 10, 2024
1 parent a32f7d2 commit 450898a
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 450898a

Please sign in to comment.