Skip to content

Commit aa05c41

Browse files
committed
bump k8s 1.34: fix Requeue removal
1 parent 66b1bb2 commit aa05c41

File tree

5 files changed

+8
-17
lines changed

5 files changed

+8
-17
lines changed

pkg/controller/machinehealthcheck/machinehealthcheck_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const (
4343
remediationStrategyAnnotation = "machine.openshift.io/remediation-strategy"
4444
remediationStrategyExternal = machinev1.RemediationStrategyType("external-baremetal")
4545
defaultNodeStartupTimeout = 10 * time.Minute
46+
defaultRequeueAfter = 1 * time.Millisecond
4647
machineNodeNameIndex = "machineNodeNameIndex"
4748
controllerName = "machinehealthcheck-controller"
4849

@@ -246,7 +247,7 @@ func (r *ReconcileMachineHealthCheck) Reconcile(ctx context.Context, request rec
246247
mhc.Spec.MaxUnhealthy,
247248
)
248249
metrics.ObserveMachineHealthCheckShortCircuitEnabled(mhc.Name, mhc.Namespace)
249-
return reconcile.Result{Requeue: true}, nil
250+
return reconcile.Result{RequeueAfter: defaultRequeueAfter}, nil
250251
}
251252
klog.V(3).Infof("Remediations are allowed for %s: total targets: %v, max unhealthy: %v, unhealthy targets: %v",
252253
request.String(),

pkg/controller/machinehealthcheck/machinehealthcheck_controller_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func TestReconcile(t *testing.T) {
307307
node: nodeHealthy,
308308
mhc: machineHealthCheck,
309309
expected: expectedReconcile{
310-
result: reconcile.Result{Requeue: true},
310+
result: reconcile.Result{},
311311
error: false,
312312
},
313313
expectedEvents: []string{},
@@ -327,7 +327,6 @@ func TestReconcile(t *testing.T) {
327327
mhc: machineHealthCheck,
328328
expected: expectedReconcile{
329329
result: reconcile.Result{
330-
Requeue: true,
331330
RequeueAfter: 300 * time.Second,
332331
},
333332
error: false,
@@ -465,7 +464,7 @@ func TestReconcile(t *testing.T) {
465464
mhc: machineHealthCheckNegativeMaxUnhealthy,
466465
expected: expectedReconcile{
467466
result: reconcile.Result{
468-
Requeue: true,
467+
RequeueAfter: defaultRequeueAfter,
469468
},
470469
error: false,
471470
},
@@ -3119,7 +3118,7 @@ func assertBaseReconcile(t *testing.T, tc testCase, ctx context.Context, r *Reco
31193118
}
31203119

31213120
if result != tc.expected.result {
3122-
if tc.expected.result.Requeue {
3121+
if tc.expected.result.RequeueAfter > 0 {
31233122
before := tc.expected.result.RequeueAfter
31243123
after := tc.expected.result.RequeueAfter + time.Second
31253124
if after < result.RequeueAfter || before > result.RequeueAfter {

pkg/operator/operator.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,6 @@ func (optr *Operator) handleSyncResult(result reconcile.Result, err error, key s
393393
// to result.RequestAfter
394394
optr.queue.Forget(key)
395395
optr.queue.AddAfter(key, result.RequeueAfter)
396-
case result.Requeue:
397-
optr.queue.AddRateLimited(key)
398396
default:
399397
// Finally, if no error occurs we Forget this item so it does not
400398
// get queued again until another change happens.

pkg/operator/sync.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (optr *Operator) syncAll(config *OperatorConfig) (reconcile.Result, error)
121121
klog.Errorf("Error waiting for resource to sync: %v", err)
122122
return reconcile.Result{}, err
123123
}
124-
if result.Requeue || result.RequeueAfter > 0 {
124+
if result.RequeueAfter > 0 {
125125
// The deployment is not yet rolled out, do not set the status to available yet
126126
return result, nil
127127
}
@@ -170,7 +170,7 @@ func (optr *Operator) checkRolloutStatus(config *OperatorConfig) (reconcile.Resu
170170
if err != nil {
171171
return reconcile.Result{}, err
172172
}
173-
if result.Requeue || result.RequeueAfter > 0 {
173+
if result.RequeueAfter > 0 {
174174
return result, nil
175175
}
176176

@@ -180,7 +180,7 @@ func (optr *Operator) checkRolloutStatus(config *OperatorConfig) (reconcile.Resu
180180
if err != nil {
181181
return reconcile.Result{}, err
182182
}
183-
if result.Requeue || result.RequeueAfter > 0 {
183+
if result.RequeueAfter > 0 {
184184
return result, nil
185185
}
186186
}

pkg/operator/sync_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ func TestCheckDeploymentRolloutStatus(t *testing.T) {
2222
name string
2323
deployment *appsv1.Deployment
2424
expectedError error
25-
expectedRequeue bool
2625
expectedRequeueAfter time.Duration
2726
}{
2827
{
@@ -52,7 +51,6 @@ func TestCheckDeploymentRolloutStatus(t *testing.T) {
5251
},
5352
},
5453
expectedError: nil,
55-
expectedRequeue: false,
5654
expectedRequeueAfter: 0,
5755
},
5856
{
@@ -82,7 +80,6 @@ func TestCheckDeploymentRolloutStatus(t *testing.T) {
8280
},
8381
},
8482
expectedError: nil,
85-
expectedRequeue: true,
8683
expectedRequeueAfter: 170 * time.Second,
8784
},
8885
{
@@ -112,7 +109,6 @@ func TestCheckDeploymentRolloutStatus(t *testing.T) {
112109
},
113110
},
114111
expectedError: nil,
115-
expectedRequeue: true,
116112
expectedRequeueAfter: 5 * time.Second,
117113
},
118114
}
@@ -145,9 +141,6 @@ func TestCheckDeploymentRolloutStatus(t *testing.T) {
145141
t.Errorf("Got error: %v, expected: %v", gotErr, tc.expectedError)
146142
}
147143

148-
if tc.expectedRequeue != result.Requeue {
149-
t.Errorf("Got requeue: %v, expected: %v", result.Requeue, tc.expectedRequeue)
150-
}
151144
if tc.expectedRequeueAfter != result.RequeueAfter.Round(time.Second) {
152145
t.Errorf("Got requeueAfter: %v, expected: %v", result.RequeueAfter.Round(time.Second), tc.expectedRequeueAfter)
153146
}

0 commit comments

Comments
 (0)