func SetupRedis(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error {
	name := managed.ControllerName(v1beta1.RedisGroupKind)
	return ctrl.NewControllerManagedBy(mgr).
		Named(name).
		WithOptions(controller.Options{
			RateLimiter: ratelimiter.NewDefaultManagedRateLimiter(rl),
		}).
		For(&v1beta1.Redis{}).
		Complete(managed.NewReconciler(mgr,
			resource.ManagedKind(v1beta1.RedisGroupVersionKind),
			managed.WithExternalConnecter(&connector{kube: mgr.GetClient()}),
			managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())),
			managed.WithPollInterval(poll),
			managed.WithLogger(l.WithValues("controller", name)),
			managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name)))))
}
SetupRedis adds a controller that reconciles Redis resources.
package cache
import (
	"context"
	"strconv"
	"time"
	"github.com/Azure/azure-sdk-for-go/profiles/latest/redis/mgmt/redis"
	"github.com/Azure/azure-sdk-for-go/profiles/latest/redis/mgmt/redis/redisapi"
	"github.com/pkg/errors"
	"k8s.io/client-go/util/workqueue"
	ctrl "sigs.k8s.io/controller-runtime"
	"sigs.k8s.io/controller-runtime/pkg/client"
	"sigs.k8s.io/controller-runtime/pkg/controller"
	xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
	"github.com/crossplane/crossplane-runtime/pkg/event"
	"github.com/crossplane/crossplane-runtime/pkg/logging"
	"github.com/crossplane/crossplane-runtime/pkg/meta"
	"github.com/crossplane/crossplane-runtime/pkg/ratelimiter"
	"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
	"github.com/crossplane/crossplane-runtime/pkg/resource"
	"github.com/crossplane/provider-azure/apis/cache/v1beta1"
	azure "github.com/crossplane/provider-azure/pkg/clients"
	redisclients "github.com/crossplane/provider-azure/pkg/clients/redis"
)
const (
	errNotRedis            = "the custom resource is not a Redis instance"
	errUpdateRedisCRFailed = "cannot update Redis custom resource instance"
	errConnectFailed        = "cannot connect to Azure API"
	errGetFailed            = "cannot get Redis instance from Azure API"
	errListAccessKeysFailed = "cannot get access key list"
	errCreateFailed         = "cannot create the Redis instance"
	errUpdateFailed         = "cannot update the Redis instance"
	errDeleteFailed         = "cannot delete the Redis instance"
)