func (redis *RedisReconciler) DeploySecret() error {
	secret := &corev1.Secret{}
	sc := redis.generateRedisSecret()
	if err := controllerutil.SetControllerReference(redis.HarborCluster, sc, redis.Scheme); err != nil {
		return err
	}
	err := redis.Client.Get(types.NamespacedName{Name: redis.HarborCluster.Name, Namespace: redis.HarborCluster.Namespace}, secret)
	if err != nil && errors.IsNotFound(err) {
		redis.Log.Info("Creating Redis Password Secret", "namespace", redis.HarborCluster.Namespace, "name", redis.HarborCluster.Name)
		return redis.Client.Create(sc)
	}
	return err
}
DeploySecret deploy the Redis Password Secret
package cache
import (
	"fmt"
	"github.com/goharbor/harbor-cluster-operator/lcm"
	corev1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	"k8s.io/apimachinery/pkg/types"
	"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
)
func (redis *RedisReconciler) Deploy() (*lcm.CRStatus, error) {
	if redis.HarborCluster.Spec.Redis.Kind == "external" {
		return cacheUnknownStatus(), nil
	}
	var expectCR *unstructured.Unstructured
	crdClient := redis.DClient.WithResource(redisFailoversGVR).WithNamespace(redis.HarborCluster.Namespace)
	expectCR, err := redis.generateRedisCR()
	if err != nil {
		return cacheNotReadyStatus(GenerateRedisCrError, err.Error()), err
	}
	if err := controllerutil.SetControllerReference(redis.HarborCluster, expectCR, redis.Scheme); err != nil {
		return cacheNotReadyStatus(SetOwnerReferenceError, err.Error()), err
	}
	if err := redis.DeploySecret(); err != nil {
		return cacheNotReadyStatus(CreateRedisSecretError, err.Error()), err
	}
	if err := redis.DeployService(); err != nil {
		return cacheNotReadyStatus(CreateRedisServerServiceError, err.Error()), err
	}
	redis.Log.Info("Creating Redis.", "namespace", redis.HarborCluster.Namespace, "name", redis.HarborCluster.Name)
	_, err = crdClient.Create(expectCR, metav1.CreateOptions{})
	if err != nil {
		return cacheNotReadyStatus(CreateRedisCrError, err.Error()), err
	}
	redis.Log.Info("Redis has been created.", "namespace", redis.HarborCluster.Namespace, "name", redis.HarborCluster.Name)
	return cacheUnknownStatus(), nil
}