Skip to content

Commit

Permalink
Merge pull request #6893 from sbueringer/pr-ssa-helper-doc
Browse files Browse the repository at this point in the history
馃尡 SSA: improve comment about metadata.uid
  • Loading branch information
k8s-ci-robot committed Jul 13, 2022
2 parents 5c177bd + 8820df7 commit 57f04eb
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,13 @@ func NewServerSidePatchHelper(ctx context.Context, original, modified client.Obj
filterObject(modifiedUnstructured, helperOptions)

// Carry over uid to match the intent to:
// * create (uid==""): Setting no uid ensures an object gets created, not updated.
// * update (uid!=""): Setting an uid ensures an object which has the same uid gets updated.
// * create (uid==""):
// * if object doesn't exist => create
// * if object already exists => update
// * update (uid!=""):
// * if object doesn't exist => fail
// * if object already exists => update
// * This allows us to enforce that an update doesn't create an object which has been deleted.
modifiedUnstructured.SetUID("")
if originalUnstructured != nil {
modifiedUnstructured.SetUID(originalUnstructured.GetUID())
Expand Down

0 comments on commit 57f04eb

Please sign in to comment.