Skip to content

Commit 27c0c94

Browse files
committed
Set a default EventHandler if the provider's main module does not supply one
- Setting a default EventHandler to keep backwards-compatibility for the generated providers Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com> (cherry picked from commit 7c2b48d)
1 parent 06bdecc commit 27c0c94

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/pipeline/templates/setup.go.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@ import (
88
ctrl "sigs.k8s.io/controller-runtime"
99

1010
"github.com/upbound/upjet/pkg/controller"
11+
"github.com/upbound/upjet/pkg/controller/handler"
1112

1213
{{ .Imports }}
1314
)
1415

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

0 commit comments

Comments
 (0)