func EnsureFinalizer(
	cr KubeDirectorObject,
) {
	finalizers := cr.GetFinalizers()
	for _, f := range finalizers {
		if f == KubeDirectorFinalizerID {
			return
		}
	}
	cr.SetFinalizers(append(finalizers, KubeDirectorFinalizerID))
}
EnsureFinalizer adds the KubeDirector finalizer into the CR's finalizers
list (if it is not in there).
package shared
import (
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"
)
const (
	KubeDirectorFinalizerID = "kubedirector.hpe.com/cleanup"
)
type KubeDirectorObject interface {
	runtime.Object
	metav1.Object
}
func HasFinalizer(
	cr KubeDirectorObject,
) bool {
	finalizers := cr.GetFinalizers()
	for _, f := range finalizers {
		if f == KubeDirectorFinalizerID {
			return true
		}
	}
	return false
}
func RemoveFinalizer(
	cr KubeDirectorObject,
) {
	finalizers := cr.GetFinalizers()
	for i, f := range finalizers {
		if f == KubeDirectorFinalizerID {
			cr.SetFinalizers(append(finalizers[:i], finalizers[i+1:]...))
			return
		}
	}
}