Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix KafkaCluster's status update at CruiseControlTask controller #889

Merged
merged 2 commits into from
Nov 10, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions controllers/cruisecontroltask_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ func (r *CruiseControlTaskReconciler) Reconcile(ctx context.Context, request ctr
// Update task states with information from Cruise Control
updateActiveTasks(tasksAndStates, ccOperations)

if err = r.UpdateStatus(ctx, instance, tasksAndStates); err != nil {
requeueWithError(log, "failed to update Kafka Cluster status", err)
}

scaler, err := r.ScaleFactory(ctx, instance)
if err != nil {
return requeueWithError(log, "failed to create Cruise Control Scaler instance", err)
Expand Down Expand Up @@ -206,7 +210,7 @@ func (r *CruiseControlTaskReconciler) Reconcile(ctx context.Context, request ctr
}

if err = r.UpdateStatus(ctx, instance, tasksAndStates); err != nil {
log.Error(err, "failed to update Kafka Cluster status")
requeueWithError(log, "failed to update Kafka Cluster status", err)
}

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

currentStatus := instance.Status.DeepCopy()
taskAndStates.SyncState(instance)
if reflect.DeepEqual(currentStatus, instance.Status) {
if reflect.DeepEqual(*currentStatus, instance.Status) {
log.Info("there are no updates to apply to Kafka Cluster Status")
return nil
}
Expand Down