From 1d7e64b1c5601e6d92a9a0d8cd078a577fecdb63 Mon Sep 17 00:00:00 2001 From: Artur Troian Date: Wed, 21 Aug 2024 17:19:58 -0500 Subject: [PATCH] fix(cluster): recover cluster params on provider restart Signed-off-by: Artur Troian --- cluster/inventory.go | 5 ++++- cluster/inventory_test.go | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cluster/inventory.go b/cluster/inventory.go index c0095635..d7f6cf8c 100644 --- a/cluster/inventory.go +++ b/cluster/inventory.go @@ -142,7 +142,10 @@ func newInventoryService( reservations := make([]*reservation, 0, len(deployments)) for _, d := range deployments { - reservations = append(reservations, newReservation(d.LeaseID().OrderID(), d.ManifestGroup())) + res := newReservation(d.LeaseID().OrderID(), d.ManifestGroup()) + res.SetClusterParams(d.ClusterParams()) + + reservations = append(reservations, res) } go is.lc.WatchChannel(ctx.Done()) diff --git a/cluster/inventory_test.go b/cluster/inventory_test.go index 899169cf..4047a9e3 100644 --- a/cluster/inventory_test.go +++ b/cluster/inventory_test.go @@ -29,6 +29,7 @@ import ( cmocks "github.com/akash-network/provider/cluster/types/v1beta3/mocks" "github.com/akash-network/provider/event" "github.com/akash-network/provider/operator/waiter" + crd "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" aclient "github.com/akash-network/provider/pkg/client/clientset/versioned" afake "github.com/akash-network/provider/pkg/client/clientset/versioned/fake" "github.com/akash-network/provider/tools/fromctx" @@ -187,6 +188,8 @@ func TestInventory_ClusterDeploymentDeployed(t *testing.T) { } deployment.On("ManifestGroup").Return(&group) + deployment.On("ClusterParams").Return(crd.ClusterSettings{}) + deployments[0] = deployment clusterClient := &mocks.Client{}