From ca02f4831ec617f3803c085fb9fbf6cdb29a1e35 Mon Sep 17 00:00:00 2001 From: Jordan Olshevski Date: Wed, 13 Dec 2023 21:46:54 +0000 Subject: [PATCH] Revert "Send resource version in patches" This reverts commit 7a949fe6815565163c451a80a9d3c67781134d8f. --- internal/controllers/reconciliation/controller.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/internal/controllers/reconciliation/controller.go b/internal/controllers/reconciliation/controller.go index 75e5dc7a..969babde 100644 --- a/internal/controllers/reconciliation/controller.go +++ b/internal/controllers/reconciliation/controller.go @@ -163,13 +163,6 @@ func (c *Controller) buildPatch(ctx context.Context, prev, resource *reconstitut prevManifest = []byte(prev.Manifest) } - // TODO: Don't bother storing the json blob on the manifest struct - var resourceManifest []byte - if resource != nil { - resource.Object.SetResourceVersion(current.GetResourceVersion()) - resourceManifest, _ = resource.Object.MarshalJSON() - } - currentJS, err := current.MarshalJSON() if err != nil { return nil, "", fmt.Errorf("building json representation of desired state: %w", err) @@ -180,11 +173,11 @@ func (c *Controller) buildPatch(ctx context.Context, prev, resource *reconstitut return nil, "", fmt.Errorf("getting merge metadata: %w", err) } if model == nil { - patch, err := jsonmergepatch.CreateThreeWayJSONMergePatch(prevManifest, []byte(resourceManifest), currentJS) + patch, err := jsonmergepatch.CreateThreeWayJSONMergePatch(prevManifest, []byte(resource.Manifest), currentJS) return patch, types.MergePatchType, err } patchmeta := strategicpatch.NewPatchMetaFromOpenAPI(model) - patch, err := strategicpatch.CreateThreeWayMergePatch(prevManifest, []byte(resourceManifest), currentJS, patchmeta, true) + patch, err := strategicpatch.CreateThreeWayMergePatch(prevManifest, []byte(resource.Manifest), currentJS, patchmeta, true) return patch, types.StrategicMergePatchType, err }