asD
This commit is contained in:
@@ -48,24 +48,31 @@ type LocustClusterReconciler struct {
|
||||
// For more details, check Reconcile and its Result here:
|
||||
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.4/pkg/reconcile
|
||||
func (r *LocustClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
|
||||
_ = logf.FromContext(ctx)
|
||||
log := logf.FromContext(ctx).WithValues()
|
||||
|
||||
logf.Log.Info("Looking up LocustCluster", "LocustClusterName", req.Name,
|
||||
"Namespace", req.Namespace)
|
||||
log.Info("Looking up LocustCluster")
|
||||
// logf.Log.Info("Looking up LocustCluster", "LocustClusterName", req.Name,
|
||||
// "Namespace", req.Namespace)
|
||||
|
||||
// locustCluster, err := GetLocustCluster(r.Client, ctx, req.Namespace, req.Name)
|
||||
_, err := GetLocustCluster(r.Client, ctx, req.Namespace, req.Name)
|
||||
locustCluster, err := GetLocustCluster(r.Client, ctx, req.Namespace, req.Name)
|
||||
if err != nil {
|
||||
if apierrors.IsNotFound(err) {
|
||||
logf.Log.Info("LocustCluster not found", "LocustClusterName", req.Name,
|
||||
"Namespace", req.Namespace)
|
||||
log.Info("LocustCluster not found")
|
||||
// logf.Log.Info("LocustCluster not found", "LocustClusterName", req.Name,
|
||||
// "Namespace", req.Namespace)
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
logf.Log.Error(err, "Failed to lookup LocustCluster", "LocustClusterName", req.Name,
|
||||
"Namespace", req.Namespace)
|
||||
log.Error(err, "LocustCluster not found")
|
||||
// logf.Log.Error(err, "Failed to lookup LocustCluster", "LocustClusterName", req.Name,
|
||||
// "Namespace", req.Namespace)
|
||||
return ctrl.Result{Requeue: true}, err
|
||||
}
|
||||
|
||||
podList, err := r.IsLeaderUp(log, locustCluster, ctx)
|
||||
|
||||
r.CreateUpdateLeader(log, locustCluster, ctx, podList)
|
||||
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user