Skip to content

feat: add initial implementation #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
random stuff
  • Loading branch information
sreya committed Jan 31, 2024
commit 50af8fbc339a42a0066be06d16646b7f7129402f
5 changes: 0 additions & 5 deletions reporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand All @@ -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())
Expand All @@ -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
},
}
Expand Down