func (r *ReconcileBasicAuth) Reconcile(request reconcile.Request) (reconcile.Result, error) {
	reqLogger = log.WithValues("Request.Namespace", request.Namespace, "Request.Name", request.Name)
	reqLogger.Info("Reconciling BasicAuth")
	ctx := context.Background()
	instance := &v1alpha1.BasicAuth{}
	err := r.client.Get(ctx, request.NamespacedName, instance)
	if err != nil {
		return crd.CheckError(err)
	}
	existing := &v1.Secret{}
	err = r.client.Get(ctx, request.NamespacedName, existing)
	if errors.IsNotFound(err) {
		return r.createNewSecret(ctx, instance, reqLogger)
	}
	if err != nil {
		return reconcile.Result{}, err
	}
	return r.updateSecret(ctx, instance, existing, reqLogger)
}
Reconcile reads that state of the cluster for a BasicAuth object and makes changes based on the state read
and what is in the Secret.Spec
Note:
The Controller will requeue the Request to be processed again if the returned error is non-nil or
Result.Requeue is true, otherwise upon completion it will remove the work from the queue.
package basicauth
import (
	"context"
	"time"
	"github.com/go-logr/logr"
	v1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/runtime"
	"sigs.k8s.io/controller-runtime/pkg/client"
	"sigs.k8s.io/controller-runtime/pkg/controller"
	"sigs.k8s.io/controller-runtime/pkg/handler"
	logf "sigs.k8s.io/controller-runtime/pkg/log"
	"sigs.k8s.io/controller-runtime/pkg/manager"
	"sigs.k8s.io/controller-runtime/pkg/reconcile"
	"sigs.k8s.io/controller-runtime/pkg/source"
	"github.com/mittwald/kubernetes-secret-generator/pkg/apis/secretgenerator/v1alpha1"
	"github.com/mittwald/kubernetes-secret-generator/pkg/controller/crd"
	"github.com/mittwald/kubernetes-secret-generator/pkg/controller/secret"
)
var log = logf.Log.WithName("controller_basicauth_secret")
var reqLogger logr.Logger
const Kind = "BasicAuth"
func Add(mgr manager.Manager) error {
	return add(mgr, NewReconciler(mgr))
}
func NewReconciler(mgr manager.Manager) reconcile.Reconciler {
	return &ReconcileBasicAuth{client: mgr.GetClient(), scheme: mgr.GetScheme()}
}
type ReconcileBasicAuth struct {
	client client.Client
	scheme *runtime.Scheme
}
func add(mgr manager.Manager, r reconcile.Reconciler) error {
	c, err := controller.New("basicauth-controller", mgr, controller.Options{Reconciler: r})
	if err != nil {
		return err
	}
	err = c.Watch(&source.Kind{Type: &v1alpha1.BasicAuth{}}, &handler.EnqueueRequestForObject{}, crd.IgnoreStatusUpdatePredicate())
	if err != nil {
		return err
	}
	return nil
}