From 7a68c4cc033a85f995cafab8e8cc820c64effe04 Mon Sep 17 00:00:00 2001 From: Ilya Lobkov Date: Tue, 23 Jan 2024 01:40:10 +0100 Subject: [PATCH] fix(kuma-cp): set creationTime on KDS sync (#8945) Signed-off-by: Ilya Lobkov --- pkg/kds/store/sync.go | 4 ++-- pkg/kds/v2/store/sync.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/kds/store/sync.go b/pkg/kds/store/sync.go index 0bb653d63384..37fe8ecddaa7 100644 --- a/pkg/kds/store/sync.go +++ b/pkg/kds/store/sync.go @@ -7,6 +7,7 @@ import ( "github.com/go-logr/logr" + "github.com/kumahq/kuma/pkg/core" "github.com/kumahq/kuma/pkg/core/resources/apis/system" core_model "github.com/kumahq/kuma/pkg/core/resources/model" "github.com/kumahq/kuma/pkg/core/resources/registry" @@ -145,11 +146,10 @@ func (s *syncResourceStore) Sync(upstream core_model.ResourceList, fs ...SyncOpt for _, r := range onCreate { rk := core_model.MetaToResourceKey(r.GetMeta()) log.Info("creating a new resource from upstream", "name", r.GetMeta().GetName(), "mesh", r.GetMeta().GetMesh()) - creationTime := r.GetMeta().GetCreationTime() createOpts := []store.CreateOptionsFunc{ store.CreateBy(rk), - store.CreatedAt(creationTime), + store.CreatedAt(core.Now()), store.CreateWithLabels(r.GetMeta().GetLabels()), } if opts.Zone != "" { diff --git a/pkg/kds/v2/store/sync.go b/pkg/kds/v2/store/sync.go index 026cd825af8f..1db62b1f5942 100644 --- a/pkg/kds/v2/store/sync.go +++ b/pkg/kds/v2/store/sync.go @@ -214,11 +214,10 @@ func (s *syncResourceStore) Sync(syncCtx context.Context, upstreamResponse clien for _, r := range onCreate { rk := core_model.MetaToResourceKey(r.GetMeta()) log.Info("creating a new resource from upstream", "name", r.GetMeta().GetName(), "mesh", r.GetMeta().GetMesh()) - creationTime := r.GetMeta().GetCreationTime() createOpts := []store.CreateOptionsFunc{ store.CreateBy(rk), - store.CreatedAt(creationTime), + store.CreatedAt(core.Now()), store.CreateWithLabels(r.GetMeta().GetLabels()), } if opts.Zone != "" {