Skip to content

Commit

Permalink
Set a default EventHandler if the provider's main module does not sup…
Browse files Browse the repository at this point in the history
…ply one

- Setting a default EventHandler to keep backwards-compatibility
  for the generated providers

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
  • Loading branch information
ulucinar committed Aug 3, 2023
1 parent caa74d2 commit 7c2b48d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/pipeline/templates/setup.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ import (
ctrl "sigs.k8s.io/controller-runtime"

"github.com/upbound/upjet/pkg/controller"
"github.com/upbound/upjet/pkg/controller/handler"

{{ .Imports }}
)

// Setup{{ .Group }} creates all controllers with the supplied logger and adds them to
// the supplied manager.
func Setup{{ .Group }}(mgr ctrl.Manager, o controller.Options) error {
// set the default event handler if the provider's main module did not
// set one.
if o.EventHandler == nil {
o.EventHandler = handler.NewEventHandler()
}
for _, setup := range []func(ctrl.Manager, controller.Options) error{
{{- range $alias := .Aliases }}
{{ $alias }}Setup,
Expand Down

0 comments on commit 7c2b48d

Please sign in to comment.