diff --git a/pkg/scaffold/v2/controller.go b/pkg/scaffold/v2/controller.go index 2bae97f8186..03a649e5889 100644 --- a/pkg/scaffold/v2/controller.go +++ b/pkg/scaffold/v2/controller.go @@ -82,6 +82,7 @@ import ( type {{ .Resource.Kind }}Reconciler struct { client.Client Log logr.Logger + Scheme *runtime.Scheme } // +kubebuilder:rbac:groups={{.GroupDomain}},resources={{ .Plural }},verbs=get;list;watch;create;update;patch;delete diff --git a/pkg/scaffold/v2/main.go b/pkg/scaffold/v2/main.go index cb2ab69ab3f..df1913ae491 100644 --- a/pkg/scaffold/v2/main.go +++ b/pkg/scaffold/v2/main.go @@ -65,6 +65,7 @@ func (m *Main) Update(opts *MainUpdateOptions) error { reconcilerSetupCodeFragment := fmt.Sprintf(`if err = (&controllers.%sReconciler{ Client: mgr.GetClient(), Log: ctrl.Log.WithName("controllers").WithName("%s"), + Scheme: mgr.GetScheme(), }).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "%s") os.Exit(1)