func (r *ReconcileRethinkDBCluster) reconcileCAConfigMap(cr *rethinkdbv1alpha1.RethinkDBCluster, caSecret *corev1.Secret) error {
	name := fmt.Sprintf("%s-ca", cr.Name)
	found := &corev1.ConfigMap{}

	err := r.client.Get(context.TODO(), types.NamespacedName{Name: name, Namespace: cr.Namespace}, found)
	if err != nil && errors.IsNotFound(err) {
		log.Info("creating new configmap", "configmap", name)
		cm, err := newCAConfigMap(cr, caSecret)
		if err != nil {
			return err
		}

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

		return r.client.Create(context.TODO(), cm)
	} else if err != nil {
		return err
	}

	log.Info("configmap exists", "configmap", found.Name)
	return nil
}
// reconcileCAConfigMap ensures the cluster CA certificate ConfigMap is present, based on the given CA Secret.
reconcileCAConfigMap ensures the cluster CA certificate ConfigMap is present, based on the given CA Secret.
// reconcileCAConfigMap ensures the cluster CA certificate ConfigMap is present based on the given CA Secret .
func (r *ReconcileRethinkDBCluster) reconcileCAConfigMap(cr *rethinkdbv1alpha1.RethinkDBCluster, caSecret *corev1.Secret) error {
	name := fmt.Sprintf("%s-ca", cr.Name)
	found := &corev1.ConfigMap{}
	err := r.client.Get(context.TODO(), types.NamespacedName{Name: name, Namespace: cr.Namespace}, found)
	if err != nil && errors.IsNotFound(err) {
		log.Info("creating new configmap", "configmap", name)
		cm, err := newCAConfigMap(cr, caSecret)
		if err != nil {
			return err
		}
		if err = controllerutil.SetControllerReference(cr, cm, r.scheme); err != nil {
			return err
		}
		return r.client.Create(context.TODO(), cm)
	} else if err != nil {
		return err
	}
	log.Info("configmap exists", "configmap", found.Name)
	return nil
}
func ( r * ReconcileRethinkDBCluster ) reconcileCAConfigMap ( cr * rethinkdbv1alpha1 . RethinkDBCluster , caSecret * corev1 . Secret ) error { name := fmt . Sprintf ( " " , cr . Name ) found := & corev1 . ConfigMap { } err := r . client . Get ( context . TODO ( ) , types . NamespacedName { Name : name , Namespace : cr . Namespace } , found ) if err != nil && errors . IsNotFound ( err ) { log . Info ( " " , " " , name ) cm , err := newCAConfigMap ( cr , caSecret ) if err != nil { return err } if err = controllerutil . SetControllerReference ( cr , cm , r . scheme ) ; err != nil { return err } return r . client . Create ( context . TODO ( ) , cm ) } else if err != nil { return err } log . Info ( " " , " " , found . Name ) return nil }
reconcileCAConfigMap ensures the cluster CA certificate ConfigMap is present, based on the given CA Secret.
reconcileCAConfigMap ensures the cluster CA certificate ConfigMap is present based on the given CA Secret .
// Set RethinkDBCluster instance as the owner and controller