func (r *RestartReconciler) reconcileNodes(ctx context.Context) (ctrl.Result, error) {
	downPods := r.PFacts.findRestartablePods()
	if len(downPods) > 0 {
		if ok := r.setATPod(); !ok {
			r.Log.Info("No pod found to run admintools from. Requeue reconciliation.")
			return ctrl.Result{Requeue: true}, nil
		}
		if res, err := r.restartPods(ctx, downPods); res.Requeue || res.RequeueAfter > 0 || err != nil {
			return res, err
		}
	}
	if r.Vdb.Spec.InitPolicy == vapi.CommunalInitPolicyScheduleOnly {
		return ctrl.Result{Requeue: r.shouldRequeueIfPodsNotRunning()}, nil
	}
	reIPPods := r.PFacts.findReIPPods(true)
	if len(reIPPods) > 0 {
		if ok := r.setATPod(); !ok {
			r.Log.Info("No pod found to run admintools from. Requeue reconciliation.")
			return ctrl.Result{Requeue: true}, nil
		}
		if res, err := r.reipNodes(ctx, reIPPods); res.Requeue || err != nil {
			return res, err
		}
	}
	return ctrl.Result{Requeue: r.shouldRequeueIfPodsNotRunning()}, nil
}
reconcileNodes will handle a subset of the pods.  It will try to restart any
pods that are down.  And it will try to reip any pods that have been
rescheduled since their install.
package controllers
import (
	"context"
	"fmt"
	"regexp"
	"strings"
	"time"
	"github.com/go-logr/logr"
	vapi "github.com/vertica/vertica-kubernetes/api/v1beta1"
	"github.com/vertica/vertica-kubernetes/pkg/cmds"
	"github.com/vertica/vertica-kubernetes/pkg/events"
	"github.com/vertica/vertica-kubernetes/pkg/names"
	"github.com/vertica/vertica-kubernetes/pkg/paths"
	"github.com/vertica/vertica-kubernetes/pkg/status"
	corev1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/types"
	ctrl "sigs.k8s.io/controller-runtime"
)
const (
	RequeueWaitTimeInSeconds = 10
	AdminToolsMapFile = "/opt/vertica/config/ipMap.txt"
	StateUp = "UP"
)
type verticaIPLookup map[string]string
type RestartReconciler struct {
	VRec    *VerticaDBReconciler
	Log     logr.Logger
	Vdb     *vapi.VerticaDB  
	PRunner cmds.PodRunner
	PFacts  *PodFacts
	ATPod   types.NamespacedName  
}
func MakeRestartReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
	vdb *vapi.VerticaDB, prunner cmds.PodRunner, pfacts *PodFacts) ReconcileActor {
	return &RestartReconciler{VRec: vdbrecon, Log: log, Vdb: vdb, PRunner: prunner, PFacts: pfacts}
}
func (r *RestartReconciler) Reconcile(ctx context.Context, req *ctrl.Request) (ctrl.Result, error) {
	if !r.Vdb.Spec.AutoRestartVertica {
		err := status.UpdateCondition(ctx, r.VRec.Client, r.Vdb,
			vapi.VerticaDBCondition{Type: vapi.AutoRestartVertica, Status: corev1.ConditionFalse},
		)
		return ctrl.Result{}, err
	}
	err := status.UpdateCondition(ctx, r.VRec.Client, r.Vdb,
		vapi.VerticaDBCondition{Type: vapi.AutoRestartVertica, Status: corev1.ConditionTrue},
	)
	if err != nil {
		return ctrl.Result{}, err
	}
	if err := r.PFacts.Collect(ctx, r.Vdb); err != nil {
		return ctrl.Result{}, err
	}
	if r.PFacts.getUpNodeCount() == 0 && r.Vdb.Spec.InitPolicy != vapi.CommunalInitPolicyScheduleOnly {
		return r.reconcileCluster(ctx)
	}
	return r.reconcileNodes(ctx)
}
func (r *RestartReconciler) reconcileCluster(ctx context.Context) (ctrl.Result, error) {
	if r.PFacts.areAllPodsRunningAndZeroInstalled() {
		r.Log.Info("All pods are running and none of them have an installation.  Nothing to restart.")
		return ctrl.Result{}, nil
	}
	if r.PFacts.countRunningAndInstalled() == 0 {
		r.Log.Info("Waiting for pods to come online that may need a Vertica restart")
		return ctrl.Result{Requeue: true}, nil
	}
	if ok := r.setATPod(); !ok {
		r.Log.Info("No pod found to run admintools from. Requeue reconciliation.")
		return ctrl.Result{Requeue: true}, nil
	}
	if res, err := r.reipNodes(ctx, r.PFacts.findReIPPods(false)); err != nil || res.Requeue {
		return res, err
	}
	dbDoesNotExist := !r.PFacts.doesDBExist().IsTrue()
	if !dbDoesNotExist {
		if upNodes, err := r.anyUpNodesInClusterState(ctx); err != nil || upNodes {
			return ctrl.Result{Requeue: upNodes}, err
		}
	}
	downPods := r.PFacts.findRestartablePods()
	if err := r.killOldProcesses(ctx, downPods); err != nil {
		return ctrl.Result{}, err
	}
	if dbDoesNotExist {
		return ctrl.Result{}, nil
	}
	return r.restartCluster(ctx)
}