Skip to content

Commit

Permalink
add default informers setup
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelvalerio committed Apr 22, 2023
1 parent bf60312 commit 0c35691
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cmd/eventlistenersink/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ import (
"context"
"log"

"github.com/tektoncd/triggers/pkg/adapter"
dynamicClientset "github.com/tektoncd/triggers/pkg/client/dynamic/clientset"
"github.com/tektoncd/triggers/pkg/client/dynamic/clientset/tekton"
"github.com/tektoncd/triggers/pkg/sink"
"k8s.io/client-go/dynamic"
evadapter "knative.dev/eventing/pkg/adapter/v2"
"knative.dev/pkg/controller"
"knative.dev/pkg/injection"
"knative.dev/pkg/injection/clients/dynamicclient"
"knative.dev/pkg/signals"

"github.com/tektoncd/triggers/pkg/adapter"
dynamicClientset "github.com/tektoncd/triggers/pkg/client/dynamic/clientset"
"github.com/tektoncd/triggers/pkg/client/dynamic/clientset/tekton"
"github.com/tektoncd/triggers/pkg/sink"
)

const (
Expand Down Expand Up @@ -66,5 +68,11 @@ func main() {
ctx = injection.WithNamespaceScope(ctx, sinkArgs.ElNamespace)
}

ictx, informers := injection.Default.SetupInformers(ctx, cfg)
if err := controller.StartInformers(ctx.Done(), informers...); err != nil {
log.Fatal("failed to start informers:", err)
}
ctx = ictx

evadapter.MainWithContext(ctx, EventListenerLogKey, adapter.NewEnvConfig, adapter.New(sinkArgs, sinkClients, recorder))
}

0 comments on commit 0c35691

Please sign in to comment.