Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Commit 9a121e7

Browse files
authored
Fix KafkaCluster's status update at CruiseControlTask controller (#889)
1 parent ad5bae2 commit 9a121e7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

controllers/cruisecontroltask_controller.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ func (r *CruiseControlTaskReconciler) Reconcile(ctx context.Context, request ctr
104104
// Update task states with information from Cruise Control
105105
updateActiveTasks(tasksAndStates, ccOperations)
106106

107+
if err = r.UpdateStatus(ctx, instance, tasksAndStates); err != nil {
108+
return requeueWithError(log, "failed to update Kafka Cluster status", err)
109+
}
110+
107111
scaler, err := r.ScaleFactory(ctx, instance)
108112
if err != nil {
109113
return requeueWithError(log, "failed to create Cruise Control Scaler instance", err)
@@ -206,7 +210,7 @@ func (r *CruiseControlTaskReconciler) Reconcile(ctx context.Context, request ctr
206210
}
207211

208212
if err = r.UpdateStatus(ctx, instance, tasksAndStates); err != nil {
209-
log.Error(err, "failed to update Kafka Cluster status")
213+
return requeueWithError(log, "failed to update Kafka Cluster status", err)
210214
}
211215

212216
return reconciled()
@@ -308,7 +312,7 @@ func (r *CruiseControlTaskReconciler) UpdateStatus(ctx context.Context, instance
308312

309313
currentStatus := instance.Status.DeepCopy()
310314
taskAndStates.SyncState(instance)
311-
if reflect.DeepEqual(currentStatus, instance.Status) {
315+
if reflect.DeepEqual(*currentStatus, instance.Status) {
312316
log.Info("there are no updates to apply to Kafka Cluster Status")
313317
return nil
314318
}

0 commit comments

Comments
 (0)