From c55fcea89dd4f220d4381755be4f0220202aa58b Mon Sep 17 00:00:00 2001 From: loft-bot <73976634+loft-bot@users.noreply.github.com> Date: Thu, 9 Jan 2025 04:04:45 -0500 Subject: [PATCH] fix: set resource version to 1 on old (#2385) (#2386) (cherry picked from commit 6a91c816f4345f2831fe31ec4df341ac672e6b23) Co-authored-by: Fabian Kramm --- Justfile | 2 +- pkg/syncer/syncer.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Justfile b/Justfile index ed39918037..f3b567ff42 100644 --- a/Justfile +++ b/Justfile @@ -15,7 +15,7 @@ _default: # Build the vcluster binary build-snapshot: - TELEMETRY_PRIVATE_KEY="" goreleaser build --snapshot --clean --single-target + TELEMETRY_PRIVATE_KEY="" goreleaser build --id vcluster --snapshot --clean # Build the vcluster release binary in snapshot mode release-snapshot: gen-license-report diff --git a/pkg/syncer/syncer.go b/pkg/syncer/syncer.go index 468351040e..ab8d767990 100644 --- a/pkg/syncer/syncer.go +++ b/pkg/syncer/syncer.go @@ -134,6 +134,12 @@ func (r *SyncController) Reconcile(ctx context.Context, vReq reconcile.Request) } }() + // debug log request + klog.FromContext(ctx).V(1).Info("Reconcile started") + defer func() { + klog.FromContext(ctx).V(1).Info("Reconcile ended") + }() + // check if we should skip reconcile lifecycle, ok := r.syncer.(syncertypes.Starter) if ok { @@ -272,6 +278,7 @@ func (r *SyncController) getObjects(ctx *synccontext.SyncContext, vReq, pReq ctr // from virtual to host correctly. vObjOld = vObj.DeepCopyObject().(client.Object) vObjOld.SetLabels(nil) + vObjOld.SetResourceVersion("1") // only add to cache if it's not deleting if vObj.GetDeletionTimestamp() == nil {