Skip to content

Commit 57f04eb

Browse files
authored
Merge pull request #6893 from sbueringer/pr-ssa-helper-doc
🌱 SSA: improve comment about metadata.uid
2 parents 5c177bd + 8820df7 commit 57f04eb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

internal/controllers/topology/cluster/structuredmerge/serversidepathhelper.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,13 @@ func NewServerSidePatchHelper(ctx context.Context, original, modified client.Obj
8383
filterObject(modifiedUnstructured, helperOptions)
8484

8585
// Carry over uid to match the intent to:
86-
// * create (uid==""): Setting no uid ensures an object gets created, not updated.
87-
// * update (uid!=""): Setting an uid ensures an object which has the same uid gets updated.
86+
// * create (uid==""):
87+
// * if object doesn't exist => create
88+
// * if object already exists => update
89+
// * update (uid!=""):
90+
// * if object doesn't exist => fail
91+
// * if object already exists => update
92+
// * This allows us to enforce that an update doesn't create an object which has been deleted.
8893
modifiedUnstructured.SetUID("")
8994
if originalUnstructured != nil {
9095
modifiedUnstructured.SetUID(originalUnstructured.GetUID())

0 commit comments

Comments
 (0)