Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
ValyaB committed Oct 22, 2024
1 parent 84063ec commit ea139e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
11 changes: 3 additions & 8 deletions cmd/monitor/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
3 changes: 1 addition & 2 deletions internal/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
}
}
Expand Down

0 comments on commit ea139e0

Please sign in to comment.