func (r *ReconcileRethinkDBCluster) Reconcile(request reconcile.Request) (reconcile.Result, error) {
	reqLogger := log.WithValues("namespace", request.Namespace, "name", request.Name)
	reqLogger.Info("reconciling RethinkDBCluster")

	// Fetch the RethinkDBCluster instance
	cluster := &rethinkdbv1alpha1.RethinkDBCluster{}
	err := r.client.Get(context.TODO(), request.NamespacedName, cluster)
	if err != nil {
		if errors.IsNotFound(err) {
			// Request object not found, could have been deleted after reconcile request.
			// Return and don't requeue
			return reconcile.Result{}, nil
		}
		// Error reading the object - requeue the request.
		return reconcile.Result{}, err
	}

	// Verify resource defaults have been initialized
	if setDefaults(cluster) {
		// defaults updated, update and requeue
		reqLogger.Info("default spec values initialized")
		return reconcile.Result{Requeue: true}, r.client.Update(context.TODO(), cluster)
	}

	// Reconcile the cluster CA secret
	caSecret, err := r.reconcileCASecret(cluster)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile ca secret")
		return reconcile.Result{}, err
	}

	// Reconcile the cluster CA configmap
	err = r.reconcileCAConfigMap(cluster, caSecret)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile ca configmap")
		return reconcile.Result{}, err
	}

	// Reconcile the admin service
	err = r.reconcileAdminService(cluster)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile admin service")
		return reconcile.Result{}, err
	}

	// Reconcile the driver service
	err = r.reconcileDriverService(cluster)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile driver service")
		return reconcile.Result{}, err
	}

	// Reconcile the cluster TLS secrets
	err = r.reconcileTLSSecrets(cluster, caSecret)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile tls secrets")
		return reconcile.Result{}, err
	}

	// Reconcile the cluster admin secret
	err = r.reconcileAdminSecret(cluster)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile admin secret")
		return reconcile.Result{}, err
	}

	// Reconcile the cluster persistent volume claims
	// err = r.reconcilePersistentVolumeClaims(cluster)
	// if err != nil {
	// 	reqLogger.Error(err, "unable to reconcile persistent volume claims")
	// 	return reconcile.Result{}, err
	// }

	// Reconcile the cluster server pods
	err = r.reconcileServerPods(cluster)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile server pods")
		return reconcile.Result{}, err
	}

	// No errors, return and don't requeue
	return reconcile.Result{}, nil
}
// Reconcile compares the actual state of the cluster to the desired state
// for the given RethinkDBCluster request.
// 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.
Reconcile compares the actual state of the cluster to the desired state
for the given RethinkDBCluster request.
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.
// Reconcile compares the actual state of the cluster to the desired state // for the given RethinkDBCluster request . // 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 .
func (r *ReconcileRethinkDBCluster) Reconcile(request reconcile.Request) (reconcile.Result, error) {
	reqLogger := log.WithValues("namespace", request.Namespace, "name", request.Name)
	reqLogger.Info("reconciling RethinkDBCluster")
	cluster := &rethinkdbv1alpha1.RethinkDBCluster{}
	err := r.client.Get(context.TODO(), request.NamespacedName, cluster)
	if err != nil {
		if errors.IsNotFound(err) {
			return reconcile.Result{}, nil
		}
		return reconcile.Result{}, err
	}
	if setDefaults(cluster) {
		reqLogger.Info("default spec values initialized")
		return reconcile.Result{Requeue: true}, r.client.Update(context.TODO(), cluster)
	}
	caSecret, err := r.reconcileCASecret(cluster)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile ca secret")
		return reconcile.Result{}, err
	}
	err = r.reconcileCAConfigMap(cluster, caSecret)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile ca configmap")
		return reconcile.Result{}, err
	}
	err = r.reconcileAdminService(cluster)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile admin service")
		return reconcile.Result{}, err
	}
	err = r.reconcileDriverService(cluster)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile driver service")
		return reconcile.Result{}, err
	}
	err = r.reconcileTLSSecrets(cluster, caSecret)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile tls secrets")
		return reconcile.Result{}, err
	}
	err = r.reconcileAdminSecret(cluster)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile admin secret")
		return reconcile.Result{}, err
	}
	err = r.reconcileServerPods(cluster)
	if err != nil {
		reqLogger.Error(err, "unable to reconcile server pods")
		return reconcile.Result{}, err
	}
	return reconcile.Result{}, nil
}
func ( r * ReconcileRethinkDBCluster ) Reconcile ( request reconcile . Request ) ( reconcile . Result , error ) { reqLogger := log . WithValues ( " " , request . Namespace , " " , request . Name ) reqLogger . Info ( " " ) cluster := & rethinkdbv1alpha1 . RethinkDBCluster { } err := r . client . Get ( context . TODO ( ) , request . NamespacedName , cluster ) if err != nil { if errors . IsNotFound ( err ) { return reconcile . Result { } , nil } return reconcile . Result { } , err } if setDefaults ( cluster ) { reqLogger . Info ( " " ) return reconcile . Result { Requeue : true } , r . client . Update ( context . TODO ( ) , cluster ) } caSecret , err := r . reconcileCASecret ( cluster ) if err != nil { reqLogger . Error ( err , " " ) return reconcile . Result { } , err } err = r . reconcileCAConfigMap ( cluster , caSecret ) if err != nil { reqLogger . Error ( err , " " ) return reconcile . Result { } , err } err = r . reconcileAdminService ( cluster ) if err != nil { reqLogger . Error ( err , " " ) return reconcile . Result { } , err } err = r . reconcileDriverService ( cluster ) if err != nil { reqLogger . Error ( err , " " ) return reconcile . Result { } , err } err = r . reconcileTLSSecrets ( cluster , caSecret ) if err != nil { reqLogger . Error ( err , " " ) return reconcile . Result { } , err } err = r . reconcileAdminSecret ( cluster ) if err != nil { reqLogger . Error ( err , " " ) return reconcile . Result { } , err } err = r . reconcileServerPods ( cluster ) if err != nil { reqLogger . Error ( err , " " ) return reconcile . Result { } , err } return reconcile . Result { } , nil }
Reconcile compares the actual state of the cluster to the desired state
for the given RethinkDBCluster request.
Reconcile compares the actual state of the cluster to the desired state for the given RethinkDBCluster request .
// Fetch the RethinkDBCluster instance // Request object not found, could have been deleted after reconcile request. // Return and don't requeue // Error reading the object - requeue the request. // Verify resource defaults have been initialized // defaults updated, update and requeue // Reconcile the cluster CA secret // Reconcile the cluster CA configmap // Reconcile the admin service // Reconcile the driver service // Reconcile the cluster TLS secrets // Reconcile the cluster admin secret // Reconcile the cluster persistent volume claims // err = r.reconcilePersistentVolumeClaims(cluster) // if err != nil { // 	reqLogger.Error(err, "unable to reconcile persistent volume claims") // 	return reconcile.Result{}, err // } // Reconcile the cluster server pods // No errors, return and don't requeue