Skip to content

Commit

Permalink
continue using replica count
Browse files Browse the repository at this point in the history
  • Loading branch information
Pothulapati committed Oct 17, 2023
1 parent 1cb3031 commit a8848c5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/controller/dragonfly_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ func (r *DragonflyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
}

// Check if the pod spec has changed
log.Info("Checking if pod spec has changed", "currentRevision", statefulSet.Status.CurrentRevision, "updateRevision", statefulSet.Status.UpdateRevision)
if statefulSet.Status.UpdatedReplicas != statefulSet.Status.Replicas || statefulSet.Status.CurrentRevision != statefulSet.Status.UpdateRevision {
log.Info("Checking if pod spec has changed", "updatedReplicas", statefulSet.Status.UpdatedReplicas, "currentReplicas", statefulSet.Status.Replicas)
if statefulSet.Status.UpdatedReplicas != statefulSet.Status.Replicas {
log.Info("Pod spec has changed, performing a rollout")
r.EventRecorder.Event(&df, corev1.EventTypeNormal, "Rollout", "Starting a rollout")

Expand All @@ -238,8 +238,9 @@ func (r *DragonflyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
}

r.EventRecorder.Event(&df, corev1.EventTypeNormal, "Resources", "Performing a rollout")

// requeue so that the rollout is processed
return ctrl.Result{Requeue: true}, nil
return ctrl.Result{RequeueAfter: 5 * time.Second}, nil
}

// Is this a Dragonfly object update?
Expand All @@ -259,8 +260,8 @@ func (r *DragonflyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
}

log.Info("Updated resources for object")
return ctrl.Result{Requeue: true}, nil
}
return ctrl.Result{}, nil
}

// SetupWithManager sets up the controller with the Manager.
Expand Down

0 comments on commit a8848c5

Please sign in to comment.