From 741bf1c60f4d9ffb2375a93a6b02dcdd36d35a12 Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Tue, 25 Feb 2025 10:16:45 +0800 Subject: [PATCH] Apply ownerref eventhough other field is ignored (#847) Signed-off-by: Jian Qiu --- pkg/work/spoke/apply/server_side_apply.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/work/spoke/apply/server_side_apply.go b/pkg/work/spoke/apply/server_side_apply.go index 40b2ea742..b720e4439 100644 --- a/pkg/work/spoke/apply/server_side_apply.go +++ b/pkg/work/spoke/apply/server_side_apply.go @@ -103,7 +103,9 @@ func (c *ServerSideApply) Apply( // skip the apply operation when the hash of the existing resource matches the required hash existingHash := existing.GetAnnotations()[workapiv1.ManifestConfigSpecHashAnnotationKey] if requiredHash == existingHash { - return existing, nil + // still needs to apply ownerref since it might be changed due to deleteoption update. + err := helper.ApplyOwnerReferences(ctx, c.client, gvr, existing, owner) + return existing, err } } }