Skip to content

Commit 041d3bd

Browse files
committed
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 1a19db2 commit 041d3bd

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
@@ -95,7 +95,7 @@ func (r *GCPManagedControlPlaneReconciler) Reconcile(ctx context.Context, req ct
9595
if apierrors.IsNotFound(err) {
9696
return ctrl.Result{}, nil
9797
}
98-
return ctrl.Result{Requeue: true}, nil
98+
return ctrl.Result{}, fmt.Errorf("getting GCPManagedControlPlane: %w", err)
9999
}
100100

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

189185
return ctrl.Result{}, nil
@@ -208,10 +204,6 @@ func (r *GCPManagedControlPlaneReconciler) reconcileDelete(ctx context.Context,
208204
log.V(4).Info("Reconciler requested requeueAfter", "reconciler", name, "after", res.RequeueAfter)
209205
return res, nil
210206
}
211-
if res.Requeue {
212-
log.V(4).Info("Reconciler requested requeue", "reconciler", name)
213-
return res, nil
214-
}
215207
}
216208

217209
if managedControlPlaneScope.GCPManagedControlPlane != nil &&

exp/controllers/gcpmanagedmachinepool_controller.go

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

242242
// Get the machine pool
@@ -353,10 +353,6 @@ func (r *GCPManagedMachinePoolReconciler) reconcile(ctx context.Context, managed
353353
log.V(4).Info("Reconciler requested requeueAfter", "reconciler", name, "after", res.RequeueAfter)
354354
return res, nil
355355
}
356-
if res.Requeue {
357-
log.V(4).Info("Reconciler requested requeue", "reconciler", name)
358-
return res, nil
359-
}
360356
}
361357

362358
return ctrl.Result{}, nil
@@ -389,10 +385,6 @@ func (r *GCPManagedMachinePoolReconciler) reconcileDelete(ctx context.Context, m
389385
log.V(4).Info("Reconciler requested requeueAfter", "reconciler", name, "after", res.RequeueAfter)
390386
return res, nil
391387
}
392-
if res.Requeue {
393-
log.V(4).Info("Reconciler requested requeue", "reconciler", name)
394-
return res, nil
395-
}
396388
}
397389

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

0 commit comments

Comments
 (0)