From f9d6f9b0a7342f33fffd9dd8f8721ce38aff468e Mon Sep 17 00:00:00 2001 From: Tyler Schade Date: Tue, 8 Aug 2023 13:34:42 -0400 Subject: [PATCH] v0.29.x: Fix bug in skv2 UpdateStatusImmutable (#471) * update * add changelog --- changelog/v0.29.11/copy-metadata-on-status-upsert.yaml | 4 ++++ pkg/controllerutils/upsert.go | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 changelog/v0.29.11/copy-metadata-on-status-upsert.yaml diff --git a/changelog/v0.29.11/copy-metadata-on-status-upsert.yaml b/changelog/v0.29.11/copy-metadata-on-status-upsert.yaml new file mode 100644 index 000000000..5ca7eb966 --- /dev/null +++ b/changelog/v0.29.11/copy-metadata-on-status-upsert.yaml @@ -0,0 +1,4 @@ +changelog: + - type: NON_USER_FACING + description: > + "Copy metadata from the existing object to the upserted object when upserting a status." diff --git a/pkg/controllerutils/upsert.go b/pkg/controllerutils/upsert.go index b3838745a..1728d6354 100644 --- a/pkg/controllerutils/upsert.go +++ b/pkg/controllerutils/upsert.go @@ -142,6 +142,8 @@ func UpdateStatusImmutable( // https://github.com/solo-io/skv2/issues/344 copyOfObj.SetUID(existing.GetUID()) + copyOfObj.SetCreationTimestamp(existing.GetCreationTimestamp()) + copyOfObj.SetResourceVersion(existing.GetResourceVersion()) return update(ctx, c, copyOfObj) }