func reconcileClusterIssuer(ctx context.Context, log logr.Logger, client client.Client, issuer *certv1.ClusterIssuer, cluster *v1alpha1.NifiCluster) error {
	obj := &certv1.ClusterIssuer{}
	var err error
	if err = client.Get(ctx, types.NamespacedName{Name: issuer.Name, Namespace: issuer.Namespace}, obj); err != nil {
		if !apierrors.IsNotFound(err) {
			return err
		}
		return client.Create(ctx, issuer)
	}
	return nil
}
reconcileClusterIssuer ensures a cert-manager ClusterIssuer
package certmanagerpki
import (
	"context"
	"fmt"
	"reflect"
	"github.com/Orange-OpenSource/nifikop/api/v1alpha1"
	"github.com/go-logr/logr"
	certv1 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2"
	corev1 "k8s.io/api/core/v1"
	apierrors "k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/types"
	"sigs.k8s.io/controller-runtime/pkg/client"
)
func reconcile(ctx context.Context, log logr.Logger, client client.Client, object runtime.Object, cluster *v1alpha1.NifiCluster) (err error) {
	switch object.(type) {
	case *certv1.Issuer:
		issuer, _ := object.(*certv1.Issuer)
		return reconcileIssuer(ctx, log, client, issuer, cluster)
	case *certv1.ClusterIssuer:
		issuer, _ := object.(*certv1.ClusterIssuer)
		return reconcileClusterIssuer(ctx, log, client, issuer, cluster)
	case *certv1.Certificate:
		cert, _ := object.(*certv1.Certificate)
		return reconcileCertificate(ctx, log, client, cert, cluster)
	case *corev1.Secret:
		secret, _ := object.(*corev1.Secret)
		return reconcileSecret(ctx, log, client, secret, cluster)
	case *v1alpha1.NifiUser:
		user, _ := object.(*v1alpha1.NifiUser)
		return reconcileUser(ctx, log, client, user, cluster)
	default:
		panic(fmt.Sprintf("Invalid object type: %v", reflect.TypeOf(object)))
	}
}