func (r *ReconcileRethinkDBCluster) reconcileAdminSecret(cr *rethinkdbv1alpha1.RethinkDBCluster) error {
	name := fmt.Sprintf("%s-%s", cr.ObjectMeta.Name, RethinkDBAdminKey)
	found := &corev1.Secret{}
	err := r.client.Get(context.TODO(), types.NamespacedName{Name: name, Namespace: cr.Namespace}, found)
	if err != nil && errors.IsNotFound(err) {
		log.Info("creating new secret", "secret", name)
		secret, err := newUserSecret(cr, RethinkDBAdminKey)
		if err != nil {
			return err
		}

		// Set RethinkDBCluster instance as the owner and controller
		if err = controllerutil.SetControllerReference(cr, secret, r.scheme); err != nil {
			return err
		}

		// Create the Secret and return
		return r.client.Create(context.TODO(), secret)
	} else if err != nil {
		return err
	}
	log.Info("secret exists", "secret", found.Name)
	return nil
}
// reconcileAdminSecret ensures the cluster admin user credentials are present.
reconcileAdminSecret ensures the cluster admin user credentials are present.
// reconcileAdminSecret ensures the cluster admin user credentials are present .
func (r *ReconcileRethinkDBCluster) reconcileAdminSecret(cr *rethinkdbv1alpha1.RethinkDBCluster) error {
	name := fmt.Sprintf("%s-%s", cr.ObjectMeta.Name, RethinkDBAdminKey)
	found := &corev1.Secret{}
	err := r.client.Get(context.TODO(), types.NamespacedName{Name: name, Namespace: cr.Namespace}, found)
	if err != nil && errors.IsNotFound(err) {
		log.Info("creating new secret", "secret", name)
		secret, err := newUserSecret(cr, RethinkDBAdminKey)
		if err != nil {
			return err
		}
		if err = controllerutil.SetControllerReference(cr, secret, r.scheme); err != nil {
			return err
		}
		return r.client.Create(context.TODO(), secret)
	} else if err != nil {
		return err
	}
	log.Info("secret exists", "secret", found.Name)
	return nil
}
func ( r * ReconcileRethinkDBCluster ) reconcileAdminSecret ( cr * rethinkdbv1alpha1 . RethinkDBCluster ) error { name := fmt . Sprintf ( " " , cr . ObjectMeta . Name , RethinkDBAdminKey ) found := & corev1 . Secret { } err := r . client . Get ( context . TODO ( ) , types . NamespacedName { Name : name , Namespace : cr . Namespace } , found ) if err != nil && errors . IsNotFound ( err ) { log . Info ( " " , " " , name ) secret , err := newUserSecret ( cr , RethinkDBAdminKey ) if err != nil { return err } if err = controllerutil . SetControllerReference ( cr , secret , r . scheme ) ; err != nil { return err } return r . client . Create ( context . TODO ( ) , secret ) } else if err != nil { return err } log . Info ( " " , " " , found . Name ) return nil }
reconcileAdminSecret ensures the cluster admin user credentials are present.
reconcileAdminSecret ensures the cluster admin user credentials are present .
// Set RethinkDBCluster instance as the owner and controller // Create the Secret and return