From 50af8fbc339a42a0066be06d16646b7f7129402f Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Wed, 31 Jan 2024 23:19:46 +0000 Subject: [PATCH] random stuff --- reporter/reporter.go | 5 ----- root.go | 12 +++++++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/reporter/reporter.go b/reporter/reporter.go index 7f99fd8..969b8d1 100644 --- a/reporter/reporter.go +++ b/reporter/reporter.go @@ -34,11 +34,6 @@ type K8sReporter struct { factory informers.SharedInformerFactory } -type WorkspaceAgent struct { - Image string - Token string -} - func (k *K8sReporter) Init(ctx context.Context) error { k.factory = informers.NewSharedInformerFactoryWithOptions(k.Client, 0, informers.WithNamespace(k.Namespace), informers.WithTweakListOptions(func(lo *v1.ListOptions) { lo.FieldSelector = k.FieldSelector diff --git a/root.go b/root.go index 933cc9a..4d1781d 100644 --- a/root.go +++ b/root.go @@ -43,12 +43,12 @@ func root() *cobra.Command { } if artifactoryURL == "" { - return xerrors.New("--coder-url is required") + return xerrors.New("--artifactory-url is required") } _, err = url.Parse(artifactoryURL) if err != nil { - return fmt.Errorf("parse coder URL: %w", err) + return fmt.Errorf("parse artifactory URL: %w", err) } if artifactoryUser == "" { @@ -75,13 +75,13 @@ func root() *cobra.Command { } coderClient := reporter.NewClient(coderParsed, coderToken) - + logger := slog.Make(sloghuman.Sink(cmd.ErrOrStderr())) kr := reporter.K8sReporter{ Client: kclient, JFrogClient: jclient, CoderClient: coderClient, Namespace: namespace, - Logger: slog.Make(sloghuman.Sink(cmd.ErrOrStderr())), + Logger: logger, } err = kr.Init(cmd.Context()) @@ -91,9 +91,11 @@ func root() *cobra.Command { stopCh := make(chan struct{}) defer close(stopCh) - go kr.Start(stopCh) + kr.Start(stopCh) <-cmd.Context().Done() + logger.Info(cmd.Context(), "exiting") + return nil }, }