From ea139e03d50cbb8835d678d20c0a5488a9def957 Mon Sep 17 00:00:00 2001 From: Valentyna Bukhalova Date: Tue, 22 Oct 2024 11:29:49 +0200 Subject: [PATCH] clean --- cmd/monitor/run.go | 11 +++-------- internal/monitor/monitor.go | 3 +-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/cmd/monitor/run.go b/cmd/monitor/run.go index 9d63bab3..26e526c7 100644 --- a/cmd/monitor/run.go +++ b/cmd/monitor/run.go @@ -44,15 +44,10 @@ func run(ctx context.Context) error { logexporter.SetupLogExporter(logger, client) - clusterIDHandler := func(clusterID string) { - log.Data["cluster_id"] = clusterID - log.Data["version"] = binVersion.Version - } - - return runMonitorMode(ctx, log, &cfg, clusterIDHandler) + return runMonitorMode(ctx, log, &cfg) } -func runMonitorMode(ctx context.Context, log *logrus.Entry, cfg *config.Config, clusterIDChanged func(clusterID string)) error { +func runMonitorMode(ctx context.Context, log *logrus.Entry, cfg *config.Config) error { restConfig, err := config.RetrieveKubeConfig(log) if err != nil { return fmt.Errorf("retrieving kubeconfig: %w", err) @@ -62,5 +57,5 @@ func runMonitorMode(ctx context.Context, log *logrus.Entry, cfg *config.Config, return fmt.Errorf("obtaining kubernetes clientset: %w", err) } - return monitor.Run(ctx, log, clientSet, cfg.MonitorMetadataPath, cfg.SelfPod, clusterIDChanged) + return monitor.Run(ctx, log, clientSet, cfg.MonitorMetadataPath, cfg.SelfPod) } diff --git a/internal/monitor/monitor.go b/internal/monitor/monitor.go index 336a4f5f..d435ba13 100644 --- a/internal/monitor/monitor.go +++ b/internal/monitor/monitor.go @@ -15,7 +15,7 @@ import ( "github.com/castai/cluster-controller/internal/config" ) -func Run(ctx context.Context, log logrus.FieldLogger, clientset *kubernetes.Clientset, metadataFile string, pod config.Pod, clusterIDHandler func(clusterID string)) error { +func Run(ctx context.Context, log logrus.FieldLogger, clientset *kubernetes.Clientset, metadataFile string, pod config.Pod) error { m := monitor{ clientset: clientset, log: log, @@ -32,7 +32,6 @@ func Run(ctx context.Context, log logrus.FieldLogger, clientset *kubernetes.Clie case <-ctx.Done(): return nil case metadata := <-metadataUpdates: - clusterIDHandler(metadata.ClusterID) m.metadataUpdated(ctx, metadata) } }