Skip to content

Commit 3b1501f

Browse files
justinsbk8s-infra-cherrypick-robot
authored andcommitted
chore: don't use Requeue in controller-runtime
It is deprecated in newer versions of controller-runtime, because it should not be used.
1 parent 6518ef9 commit 3b1501f

File tree

5 files changed

+3
-21
lines changed

5 files changed

+3
-21
lines changed

controllers/gcpcluster_controller_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ var _ = Describe("GCPClusterReconciler", func() {
5555
})
5656
Expect(err).NotTo(HaveOccurred())
5757
Expect(result.RequeueAfter).To(BeZero())
58-
Expect(result.Requeue).To(BeFalse())
5958
})
6059
})
6160
})

controllers/gcpmachine_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func (r *GCPMachineReconciler) reconcile(ctx context.Context, machineScope *scop
245245
default:
246246
machineScope.SetFailureReason("UpdateError")
247247
machineScope.SetFailureMessage(errors.Errorf("GCPMachine instance state %s is unexpected", instanceState))
248-
return ctrl.Result{Requeue: true}, nil
248+
return ctrl.Result{RequeueAfter: reconciler.DefaultRetryTime}, nil
249249
}
250250
}
251251

controllers/gcpmachine_controller_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ var _ = Describe("GCPMachineReconciler", func() {
4747
})
4848
Expect(err).NotTo(HaveOccurred())
4949
Expect(result.RequeueAfter).To(BeZero())
50-
Expect(result.Requeue).To(BeFalse())
5150
})
5251
})
5352
})

exp/controllers/gcpmanagedcontrolplane_controller.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (r *GCPManagedControlPlaneReconciler) Reconcile(ctx context.Context, req ct
9696
if apierrors.IsNotFound(err) {
9797
return ctrl.Result{}, nil
9898
}
99-
return ctrl.Result{Requeue: true}, nil
99+
return ctrl.Result{}, fmt.Errorf("getting GCPManagedControlPlane: %w", err)
100100
}
101101

102102
// Get the cluster
@@ -181,10 +181,6 @@ func (r *GCPManagedControlPlaneReconciler) reconcile(ctx context.Context, manage
181181
log.V(4).Info("Reconciler requested requeueAfter", "reconciler", name, "after", res.RequeueAfter)
182182
return res, nil
183183
}
184-
if res.Requeue {
185-
log.V(4).Info("Reconciler requested requeue", "reconciler", name)
186-
return res, nil
187-
}
188184
}
189185

190186
return ctrl.Result{}, nil
@@ -209,10 +205,6 @@ func (r *GCPManagedControlPlaneReconciler) reconcileDelete(ctx context.Context,
209205
log.V(4).Info("Reconciler requested requeueAfter", "reconciler", name, "after", res.RequeueAfter)
210206
return res, nil
211207
}
212-
if res.Requeue {
213-
log.V(4).Info("Reconciler requested requeue", "reconciler", name)
214-
return res, nil
215-
}
216208
}
217209

218210
if managedControlPlaneScope.GCPManagedControlPlane != nil &&

exp/controllers/gcpmanagedmachinepool_controller.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func (r *GCPManagedMachinePoolReconciler) Reconcile(ctx context.Context, req ctr
235235
if apierrors.IsNotFound(err) {
236236
return ctrl.Result{}, nil
237237
}
238-
return ctrl.Result{Requeue: true}, nil
238+
return ctrl.Result{}, fmt.Errorf("getting GCPManagedMachinePool: %w", err)
239239
}
240240

241241
// Get the machine pool
@@ -349,10 +349,6 @@ func (r *GCPManagedMachinePoolReconciler) reconcile(ctx context.Context, managed
349349
log.V(4).Info("Reconciler requested requeueAfter", "reconciler", name, "after", res.RequeueAfter)
350350
return res, nil
351351
}
352-
if res.Requeue {
353-
log.V(4).Info("Reconciler requested requeue", "reconciler", name)
354-
return res, nil
355-
}
356352
}
357353

358354
return ctrl.Result{}, nil
@@ -385,10 +381,6 @@ func (r *GCPManagedMachinePoolReconciler) reconcileDelete(ctx context.Context, m
385381
log.V(4).Info("Reconciler requested requeueAfter", "reconciler", name, "after", res.RequeueAfter)
386382
return res, nil
387383
}
388-
if res.Requeue {
389-
log.V(4).Info("Reconciler requested requeue", "reconciler", name)
390-
return res, nil
391-
}
392384
}
393385

394386
if conditions.Get(managedMachinePoolScope.GCPManagedMachinePool, infrav1exp.GKEMachinePoolDeletingCondition).Reason == infrav1exp.GKEMachinePoolDeletedReason {

0 commit comments

Comments
 (0)