Skip to content

Commit

Permalink
drop manual use of knative.dev/pkg::injection.Dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
dprotaso authored and tekton-robot committed May 19, 2023
1 parent 584a556 commit c366270
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
13 changes: 5 additions & 8 deletions cmd/eventlistenersink/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,10 @@ func main() {
dc = dynamicClientset.New(tekton.WithClient(dc))
ctx = context.WithValue(ctx, dynamicclient.Key{}, dc)

// Set up ctx with the set of things based on the
// dynamic client we've set up above.
ctx = injection.Dynamic.SetupDynamic(ctx)

sinkArgs, err := sink.GetArgs()
if err != nil {
log.Fatal(err.Error())
}
sinkClients, err := sink.ConfigureClients(ctx, cfg)
if err != nil {
log.Fatal(err.Error())
}
recorder, err := sink.NewRecorder()
if err != nil {
log.Fatal(err.Error())
Expand All @@ -72,6 +64,11 @@ func main() {
if err := controller.StartInformers(ctx.Done(), informers...); err != nil {
log.Fatal("failed to start informers:", err)
}

sinkClients, err := sink.ConfigureClients(ctx, cfg)
if err != nil {
log.Fatal(err.Error())
}
ctx = ictx

evadapter.MainWithContext(ctx, EventListenerLogKey, adapter.NewEnvConfig, adapter.New(sinkArgs, sinkClients, recorder))
Expand Down
6 changes: 0 additions & 6 deletions pkg/reconciler/metrics/injection.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ import (
func init() {
injection.Default.RegisterClient(func(ctx context.Context, _ *rest.Config) context.Context { return WithClient(ctx) })
injection.Default.RegisterInformer(WithInformer)

injection.Dynamic.RegisterDynamicClient(WithClient)
injection.Dynamic.RegisterDynamicInformer(func(ctx context.Context) context.Context {
ctx, _ = WithInformer(ctx)
return ctx
})
}

// RecorderKey is used for associating the Recorder inside the context.Context.
Expand Down
1 change: 0 additions & 1 deletion pkg/sink/cloudevent/cloudeventclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func init() {
injection.Default.RegisterClient(func(ctx context.Context, _ *rest.Config) context.Context {
return withCloudEventClient(ctx)
})
injection.Dynamic.RegisterDynamicClient(withCloudEventClient)
}

// CECKey is used to associate the CloudEventClient inside the context.Context
Expand Down

0 comments on commit c366270

Please sign in to comment.