func WithEventRecorder(er record.EventRecorder) Option {
	return func(r *Reconciler) error {
		r.eventRecorder = er
		return nil
	}
}
WithEventRecorder is an Option that configures a Reconciler's EventRecorder.

By default, manager.GetEventRecorderFor() is used if this option is not
configured.
package reconciler
import (
	"context"
	"errors"
	"fmt"
	"strings"
	"sync"
	"time"
	"github.com/go-logr/logr"
	sdkhandler "github.com/operator-framework/operator-lib/handler"
	"helm.sh/helm/v3/pkg/action"
	"helm.sh/helm/v3/pkg/chart"
	"helm.sh/helm/v3/pkg/chartutil"
	"helm.sh/helm/v3/pkg/release"
	"helm.sh/helm/v3/pkg/storage/driver"
	corev1 "k8s.io/api/core/v1"
	apierrors "k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/client-go/tools/record"
	ctrl "sigs.k8s.io/controller-runtime"
	"sigs.k8s.io/controller-runtime/pkg/client"
	"sigs.k8s.io/controller-runtime/pkg/controller"
	"sigs.k8s.io/controller-runtime/pkg/handler"
	"sigs.k8s.io/controller-runtime/pkg/source"
	"github.com/operator-framework/helm-operator-plugins/pkg/annotation"
	helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
	"github.com/operator-framework/helm-operator-plugins/pkg/hook"
	"github.com/operator-framework/helm-operator-plugins/pkg/internal/sdk/controllerutil"
	"github.com/operator-framework/helm-operator-plugins/pkg/reconciler/internal/conditions"
	internalhook "github.com/operator-framework/helm-operator-plugins/pkg/reconciler/internal/hook"
	"github.com/operator-framework/helm-operator-plugins/pkg/reconciler/internal/updater"
	internalvalues "github.com/operator-framework/helm-operator-plugins/pkg/reconciler/internal/values"
	"github.com/operator-framework/helm-operator-plugins/pkg/values"
)
const uninstallFinalizer = "uninstall-helm-release"
type Reconciler struct {
	client             client.Client
	actionClientGetter helmclient.ActionClientGetter
	valueMapper        values.Mapper
	eventRecorder      record.EventRecorder
	preHooks           []hook.PreHook
	postHooks          []hook.PostHook
	log                     logr.Logger
	gvk                     *schema.GroupVersionKind
	chrt                    *chart.Chart
	overrideValues          map[string]string
	skipDependentWatches    bool
	maxConcurrentReconciles int
	reconcilePeriod         time.Duration
	maxHistory              int
	annotSetupOnce       sync.Once
	annotations          map[string]struct{}
	installAnnotations   map[string]annotation.Install
	upgradeAnnotations   map[string]annotation.Upgrade
	uninstallAnnotations map[string]annotation.Uninstall
}
func New(opts ...Option) (*Reconciler, error) {
	r := &Reconciler{}
	r.annotSetupOnce.Do(r.setupAnnotationMaps)
	for _, o := range opts {
		if err := o(r); err != nil {
			return nil, err
		}
	}
	if err := r.validate(); err != nil {
		return nil, err
	}
	return r, nil
}
func (r *Reconciler) setupAnnotationMaps() {
	r.annotations = make(map[string]struct{})
	r.installAnnotations = make(map[string]annotation.Install)
	r.upgradeAnnotations = make(map[string]annotation.Upgrade)
	r.uninstallAnnotations = make(map[string]annotation.Uninstall)
}
func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
	controllerName := fmt.Sprintf("%v-controller", strings.ToLower(r.gvk.Kind))
	r.addDefaults(mgr, controllerName)
	r.setupScheme(mgr)
	c, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r, MaxConcurrentReconciles: r.maxConcurrentReconciles})
	if err != nil {
		return err
	}
	if err := r.setupWatches(mgr, c); err != nil {
		return err
	}
	r.log.Info("Watching resource",
		"group", r.gvk.Group,
		"version", r.gvk.Version,
		"kind", r.gvk.Kind,
	)
	return nil
}
type Option func(r *Reconciler) error
func WithClient(cl client.Client) Option {
	return func(r *Reconciler) error {
		r.client = cl
		return nil
	}
}
func WithActionClientGetter(actionClientGetter helmclient.ActionClientGetter) Option {
	return func(r *Reconciler) error {
		r.actionClientGetter = actionClientGetter
		return nil
	}
}