func (r *ReconcileRethinkDBCluster) removeServer(cr *rethinkdbv1alpha1.RethinkDBCluster, servers []corev1.Pod) error {
	if len(servers) <= 0 {
		return nil
	}

	pod := servers[0]
	log.Info("removing existing server pod", "pod", pod.Name)

	err := r.client.Delete(context.TODO(), &pod)
	if err != nil {
		return err
	}

	// Pod deleted successfully, update status and return
	servers = append(servers[:0], servers[1:]...)
	cr.Status.Servers = []string{}
	for _, pod := range servers {
		cr.Status.Servers = append(cr.Status.Servers, pod.Name)
	}
	return r.client.Status().Update(context.TODO(), cr)
}
// removeServer will delete a server Pod from the cluster. The first Pod in the provided slice of servers will be deleted.
removeServer will delete a server Pod from the cluster. The first Pod in the provided slice of servers will be deleted.
// removeServer will delete a server Pod from the cluster . The first Pod in the provided slice of servers will be deleted .
func (r *ReconcileRethinkDBCluster) removeServer(cr *rethinkdbv1alpha1.RethinkDBCluster, servers []corev1.Pod) error {
	if len(servers) <= 0 {
		return nil
	}
	pod := servers[0]
	log.Info("removing existing server pod", "pod", pod.Name)
	err := r.client.Delete(context.TODO(), &pod)
	if err != nil {
		return err
	}
	servers = append(servers[:0], servers[1:]...)
	cr.Status.Servers = []string{}
	for _, pod := range servers {
		cr.Status.Servers = append(cr.Status.Servers, pod.Name)
	}
	return r.client.Status().Update(context.TODO(), cr)
}
func ( r * ReconcileRethinkDBCluster ) removeServer ( cr * rethinkdbv1alpha1 . RethinkDBCluster , servers [ ] corev1 . Pod ) error { if len ( servers ) <= 0 { return nil } pod := servers [ 0 ] log . Info ( " " , " " , pod . Name ) err := r . client . Delete ( context . TODO ( ) , & pod ) if err != nil { return err } servers = append ( servers [ : 0 ] , servers [ 1 : ] ... ) cr . Status . Servers = [ ] string { } for _ , pod := range servers { cr . Status . Servers = append ( cr . Status . Servers , pod . Name ) } return r . client . Status ( ) . Update ( context . TODO ( ) , cr ) }
removeServer will delete a server Pod from the cluster.
removeServer will delete a server Pod from the cluster .
// Pod deleted successfully, update status and return