From abdc7881e3e404f4293b2922098a38420629bbb7 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 6 Jun 2024 23:06:47 +0800 Subject: [PATCH] upgrade ocm and sdk (#114) Signed-off-by: Wei Liu Co-authored-by: Chunlin Yang --- go.mod | 6 +++--- go.sum | 12 ++++++------ test/helper.go | 10 +++++++--- test/integration/pulse_server_test.go | 2 +- test/integration/resource_test.go | 8 ++++---- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 40dae9a1..c986a93c 100755 --- a/go.mod +++ b/go.mod @@ -41,9 +41,9 @@ require ( k8s.io/client-go v0.29.4 k8s.io/component-base v0.29.3 k8s.io/klog/v2 v2.120.1 - open-cluster-management.io/api v0.13.1-0.20240506072237-800b00d9f0db - open-cluster-management.io/ocm v0.13.1-0.20240521012022-92a2c91f1594 - open-cluster-management.io/sdk-go v0.13.1-0.20240520073308-f18d198a844d + open-cluster-management.io/api v0.13.1-0.20240521030453-9d94703b9eba + open-cluster-management.io/ocm v0.13.1-0.20240606073633-61a74bb348a4 + open-cluster-management.io/sdk-go v0.13.1-0.20240606075054-7671bb086504 ) require ( diff --git a/go.sum b/go.sum index c65a9b29..a88466b4 100755 --- a/go.sum +++ b/go.sum @@ -1173,12 +1173,12 @@ k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/A k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY= k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -open-cluster-management.io/api v0.13.1-0.20240506072237-800b00d9f0db h1:puVfabidvMj0phg34e5PqAmC0jzFiVN5LCNlZIEk+CA= -open-cluster-management.io/api v0.13.1-0.20240506072237-800b00d9f0db/go.mod h1:yrNuMMpciXjXPnj2yznb6LTyrGliiTrFZAJDp/Ck3c4= -open-cluster-management.io/ocm v0.13.1-0.20240521012022-92a2c91f1594 h1:BA7d2C96rNIu1SGs4OwJ1s21Gp9aEwlYDL3ZdQokA8g= -open-cluster-management.io/ocm v0.13.1-0.20240521012022-92a2c91f1594/go.mod h1:0l7ESHU83bf7ZrOD8Zv0fQRBoIyAHKaD7SW7Hp5wNik= -open-cluster-management.io/sdk-go v0.13.1-0.20240520073308-f18d198a844d h1:5lcrL1DsQdNtDQU6U2oXwLAN0EBczcvI421YNgEzL/4= -open-cluster-management.io/sdk-go v0.13.1-0.20240520073308-f18d198a844d/go.mod h1:XBrldz+AqVBy9miOVNIu+6l8JXS18i795XbTqIqURJU= +open-cluster-management.io/api v0.13.1-0.20240521030453-9d94703b9eba h1:UsXnD4/N7pxYupPgoLvTq8wO73V72vD2D2ZkDd4iws0= +open-cluster-management.io/api v0.13.1-0.20240521030453-9d94703b9eba/go.mod h1:yrNuMMpciXjXPnj2yznb6LTyrGliiTrFZAJDp/Ck3c4= +open-cluster-management.io/ocm v0.13.1-0.20240606073633-61a74bb348a4 h1:waZV6MKK01jRUmUyLyLRLZUjCdaCvs/AJwqQPNcEHoo= +open-cluster-management.io/ocm v0.13.1-0.20240606073633-61a74bb348a4/go.mod h1:em/6OHu/z7vkwoQanhC3i3lA8bQiKuBQlik6cyk3E5o= +open-cluster-management.io/sdk-go v0.13.1-0.20240606075054-7671bb086504 h1:65KSUUpUapTbaeMx+MuxCqXRyrR3KGtOSFuoJwoXmMA= +open-cluster-management.io/sdk-go v0.13.1-0.20240606075054-7671bb086504/go.mod h1:muWzHWsgK8IsopltwTnsBjf4DN9IcC9rF0G2uEq/Pjw= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/test/helper.go b/test/helper.go index 9b3a2543..11513045 100755 --- a/test/helper.go +++ b/test/helper.go @@ -15,6 +15,7 @@ import ( "github.com/openshift-online/maestro/pkg/controllers" "github.com/openshift-online/maestro/pkg/event" "github.com/openshift-online/maestro/pkg/logger" + workv1informers "open-cluster-management.io/api/client/work/informers/externalversions/work/v1" workv1 "open-cluster-management.io/api/work/v1" "open-cluster-management.io/sdk-go/pkg/cloudevents/generic" grpcoptions "open-cluster-management.io/sdk-go/pkg/cloudevents/generic/options/grpc" @@ -75,6 +76,7 @@ type Helper struct { PulseServer *server.PulseServer ControllerManager *server.ControllersServer WorkAgentHolder *work.ClientHolder + WorkAgentInformer workv1informers.ManifestWorkInformer TimeFunc TimeFunc JWTPrivateKey *rsa.PrivateKey JWTCA *rsa.PublicKey @@ -260,17 +262,19 @@ func (helper *Helper) StartWorkAgent(ctx context.Context, clusterName string, bu workCodec = codec.NewManifestCodec(nil) } - clientHolder, err := work.NewClientHolderBuilder(mqttOptions). + clientHolder, informer, err := work.NewClientHolderBuilder(mqttOptions). WithClientID(clusterName). WithClusterName(clusterName). WithCodecs(workCodec). - NewAgentClientHolder(ctx) + NewAgentClientHolderWithInformer(ctx) if err != nil { glog.Fatalf("Unable to create work agent holder: %s", err) } - go clientHolder.ManifestWorkInformer().Informer().Run(ctx.Done()) + go informer.Informer().Run(ctx.Done()) + helper.WorkAgentHolder = clientHolder + helper.WorkAgentInformer = informer } func (helper *Helper) StartGRPCResourceSourceClient() { diff --git a/test/integration/pulse_server_test.go b/test/integration/pulse_server_test.go index 23da8a7e..a14ae4c9 100644 --- a/test/integration/pulse_server_test.go +++ b/test/integration/pulse_server_test.go @@ -65,7 +65,7 @@ func TestPulseServer(t *testing.T) { h.StartControllerManager(ctx) h.StartWorkAgent(ctx, consumer.Name, false) clientHolder := h.WorkAgentHolder - informer := clientHolder.ManifestWorkInformer() + informer := h.WorkAgentInformer lister := informer.Lister().ManifestWorks(consumer.Name) agentWorkClient := clientHolder.ManifestWorks(consumer.Name) resourceService := h.Env().Services.Resources() diff --git a/test/integration/resource_test.go b/test/integration/resource_test.go index f190ae65..b6900da1 100755 --- a/test/integration/resource_test.go +++ b/test/integration/resource_test.go @@ -68,7 +68,7 @@ func TestResourcePost(t *testing.T) { h.StartControllerManager(ctx) h.StartWorkAgent(ctx, consumer.Name, false) clientHolder := h.WorkAgentHolder - informer := clientHolder.ManifestWorkInformer() + informer := h.WorkAgentInformer lister := informer.Lister().ManifestWorks(consumer.Name) agentWorkClient := clientHolder.ManifestWorks(consumer.Name) resourceService := h.Env().Services.Resources() @@ -282,7 +282,7 @@ func TestResourcePatch(t *testing.T) { h.StartControllerManager(ctx) h.StartWorkAgent(ctx, consumer.ID, false) clientHolder := h.WorkAgentHolder - informer := clientHolder.ManifestWorkInformer() + informer := h.WorkAgentInformer lister := informer.Lister().ManifestWorks(consumer.ID) agentWorkClient := clientHolder.ManifestWorks(consumer.ID) @@ -558,7 +558,7 @@ func TestResourceFromGRPC(t *testing.T) { h.StartControllerManager(ctx) h.StartWorkAgent(ctx, consumer.Name, false) clientHolder := h.WorkAgentHolder - informer := clientHolder.ManifestWorkInformer() + informer := h.WorkAgentInformer agentWorkClient := clientHolder.ManifestWorks(consumer.Name) // use grpc client to create resource @@ -766,7 +766,7 @@ func TestResourceBundleFromGRPC(t *testing.T) { h.StartControllerManager(ctx) h.StartWorkAgent(ctx, consumer.Name, true) clientHolder := h.WorkAgentHolder - informer := clientHolder.ManifestWorkInformer() + informer := h.WorkAgentInformer agentWorkClient := clientHolder.ManifestWorks(consumer.Name) // use grpc client to create resource bundle