Skip to content

Commit ade70d8

Browse files
authored
fix: lastScaledAt not updated during autoscaling down (#2323)
1 parent cd1fcb4 commit ade70d8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/reconciler/monovertex/controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ func (mr *monoVertexReconciler) orchestratePods(ctx context.Context, monoVtx *df
206206
if err := mr.cleanUpPodsFromTo(ctx, monoVtx, desiredReplicas, math.MaxInt); err != nil {
207207
return fmt.Errorf("failed to clean up mono vertex pods [%v, ∞): %w", desiredReplicas, err)
208208
}
209-
if currentReplicas := int(monoVtx.Status.Replicas); currentReplicas > desiredReplicas {
209+
currentReplicas := int(monoVtx.Status.Replicas)
210+
if currentReplicas > desiredReplicas {
210211
monoVtx.Status.Replicas = uint32(desiredReplicas)
211212
}
212213
updatedReplicas := int(monoVtx.Status.UpdatedReplicas)
@@ -286,7 +287,6 @@ func (mr *monoVertexReconciler) orchestratePods(ctx context.Context, monoVtx *df
286287
}
287288
}
288289

289-
currentReplicas := int(monoVtx.Status.Replicas)
290290
if currentReplicas != desiredReplicas {
291291
log.Infow("MonoVertex replicas changed", "currentReplicas", currentReplicas, "desiredReplicas", desiredReplicas)
292292
mr.recorder.Eventf(monoVtx, corev1.EventTypeNormal, "ReplicasScaled", "Replicas changed from %d to %d", currentReplicas, desiredReplicas)

pkg/reconciler/vertex/controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ func (r *vertexReconciler) orchestratePods(ctx context.Context, vertex *dfv1.Ver
220220
if err := r.cleanUpPodsFromTo(ctx, vertex, desiredReplicas, math.MaxInt); err != nil {
221221
return fmt.Errorf("failed to clean up vertex pods [%v, ∞): %w", desiredReplicas, err)
222222
}
223-
if currentReplicas := int(vertex.Status.Replicas); currentReplicas > desiredReplicas {
223+
currentReplicas := int(vertex.Status.Replicas)
224+
if currentReplicas > desiredReplicas {
224225
vertex.Status.Replicas = uint32(desiredReplicas)
225226
}
226227
updatedReplicas := int(vertex.Status.UpdatedReplicas)
@@ -300,7 +301,6 @@ func (r *vertexReconciler) orchestratePods(ctx context.Context, vertex *dfv1.Ver
300301
}
301302
}
302303

303-
currentReplicas := int(vertex.Status.Replicas)
304304
if currentReplicas != desiredReplicas {
305305
log.Infow("Pipeline Vertex replicas changed", "currentReplicas", currentReplicas, "desiredReplicas", desiredReplicas)
306306
r.recorder.Eventf(vertex, corev1.EventTypeNormal, "ReplicasScaled", "Replicas changed from %d to %d", currentReplicas, desiredReplicas)

0 commit comments

Comments
 (0)