From 157340cdc66c37e5481fce8f38045f67c77abd1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Fern=C3=A1ndez?= Date: Tue, 12 Mar 2024 12:22:50 -0500 Subject: [PATCH] fix: merge (#311) --- internal/controller/kbot.go | 1 + internal/controller/state.go | 20 +++++--------------- internal/router/api/v1/cluster.go | 1 - 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/internal/controller/kbot.go b/internal/controller/kbot.go index 49556851..56698e39 100644 --- a/internal/controller/kbot.go +++ b/internal/controller/kbot.go @@ -8,6 +8,7 @@ package controller import ( "github.com/kubefirst/kubefirst-api/internal/secrets" + pkg "github.com/kubefirst/kubefirst-api/pkg/utils" "github.com/kubefirst/metrics-client/pkg/telemetry" log "github.com/rs/zerolog/log" ) diff --git a/internal/controller/state.go b/internal/controller/state.go index d3c2e112..825e65d3 100644 --- a/internal/controller/state.go +++ b/internal/controller/state.go @@ -227,25 +227,15 @@ func (clctrl *ClusterController) StateStoreCreate() error { return err } - err = clctrl.MdbCl.UpdateCluster(clctrl.ClusterName, "state_store_details", pkgtypes.StateStoreDetails{ + clctrl.Cluster.StateStoreDetails = pkgtypes.StateStoreDetails{ Name: bucketAndCreds.StateStoreDetails.Name, Hostname: bucketAndCreds.StateStoreDetails.Hostname, - }) - if err != nil { - return err - } - - err = clctrl.MdbCl.UpdateCluster(clctrl.ClusterName, "state_store_create_check", true) - if err != nil { - return err - } - - err = clctrl.MdbCl.UpdateCluster(clctrl.ClusterName, "state_store_credentials", bucketAndCreds.StateStoreCredentials) - if err != nil { - return err } + clctrl.Cluster.StateStoreCreateCheck = true + clctrl.Cluster.StateStoreCredentials = bucketAndCreds.StateStoreCredentials + clctrl.Cluster.StateStoreCredsCheck = true - err = clctrl.MdbCl.UpdateCluster(clctrl.ClusterName, "state_store_creds_check", true) + err = secrets.UpdateCluster(clctrl.KubernetesClient, clctrl.Cluster) if err != nil { return err } diff --git a/internal/router/api/v1/cluster.go b/internal/router/api/v1/cluster.go index b19f36dc..5d212c6a 100644 --- a/internal/router/api/v1/cluster.go +++ b/internal/router/api/v1/cluster.go @@ -10,7 +10,6 @@ import ( "context" "fmt" "net/http" - "os" "strings" "github.com/gin-gonic/gin"