func finalize(h Handler, resource runtime.Object, observed, dependent []reconciler.Object) error {
	if s, ok := h.(FinalizeInterface); ok {
		return s.Finalize(resource, observed, dependent)
	}
	r := resource.(metav1.Object)
	finalizer.RemoveStandard(r)
	return nil
}
finalize - Finalize component
package genericreconciler
import (
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"
	"reflect"
	"sigs.k8s.io/controller-reconciler/pkg/finalizer"
	"sigs.k8s.io/controller-reconciler/pkg/reconciler"
	"sigs.k8s.io/controller-reconciler/pkg/reconciler/manager"
	"strings"
	"time"
)
const (
	LabelResource          = "custom-resource"
	LabelResourceName      = "custom-resource-name"
	LabelResourceNamespace = "custom-resource-namespace"
	LabelUsing             = "using"
)
type Handler interface {
	Objects(api interface{}, labels map[string]string, observed, dependent, aggregated []reconciler.Object) ([]reconciler.Object, error)
	Observables(api interface{}, labels map[string]string, dependent []reconciler.Object) []reconciler.Observable
}
type StatusInterface interface {
	UpdateStatus(api interface{}, reconciled []reconciler.Object, err error) time.Duration
}
type FinalizeInterface interface {
	Finalize(api interface{}, dependent, observed []reconciler.Object) error
}
type DiffersInterface interface {
	Differs(expected reconciler.Object, observed reconciler.Object) bool
}
type DependentResourcesInterface interface {
	DependentResources(api interface{}) []reconciler.Object
}
func getLabels(ro runtime.Object, using string) map[string]string {
	r := ro.(metav1.Object)
	return map[string]string{
		LabelResource:          strings.Trim(reflect.TypeOf(r).String(), "*"),
		LabelResourceName:      r.GetName(),
		LabelResourceNamespace: r.GetNamespace(),
		LabelUsing:             strings.Trim(using, "*"),
	}
}
func dependentResources(h Handler, resource runtime.Object) []reconciler.Object {
	if s, ok := h.(DependentResourcesInterface); ok {
		return s.DependentResources(resource)
	}
	return []reconciler.Object{}
}
func differs(h Handler, expected reconciler.Object, observed reconciler.Object) bool {
	if s, ok := h.(DiffersInterface); ok {
		return s.Differs(expected, observed)
	}
	return true
}