From e7a8105aa4d8382ce15175f963229a501ef6a84b Mon Sep 17 00:00:00 2001 From: Ilker Manap Date: Wed, 30 Sep 2026 18:41:43 +0200 Subject: [PATCH] Log a preempted replica's stop with the grace it had It said "stopping a drained replica without a replacement after=5m0s" when it had been given the 30-second preemption grace. Co-Authored-By: Claude Opus 5.5 (1M context) --- internal/control/reconciler/reconciler.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/control/reconciler/reconciler.go b/internal/control/reconciler/reconciler.go index 5c30f9a..ed10e68 100644 --- a/internal/control/reconciler/reconciler.go +++ b/internal/control/reconciler/reconciler.go @@ -755,10 +755,10 @@ func (r *Reconciler) reconcileModel(ctx context.Context, m catalog.Model) { r.mu.Lock() rep, ok := r.replicas[id] var expired bool + grace, preemptedFor := r.cfg.DrainGrace, "" if ok { - grace := r.cfg.DrainGrace if rep.PreemptedFor != "" { - grace = r.cfg.PreemptGrace + grace, preemptedFor = r.cfg.PreemptGrace, rep.PreemptedFor } expired = !rep.DrainingAt.IsZero() && r.now().Sub(rep.DrainingAt) > grace } @@ -768,11 +768,15 @@ func (r *Reconciler) reconcileModel(ctx context.Context, m catalog.Model) { case !ok: case replaced: r.stopReplica(ctx, id) + case expired && preemptedFor != "": + r.log.Info("stopping a preempted replica", "replica", id, + "for", preemptedFor, "after", grace) + r.stopReplica(ctx, id) case expired: // The replacement never arrived — often because nowhere else can // host it. Draining forever would leave the node undrainable. r.log.Warn("stopping a drained replica without a replacement", - "replica", id, "after", r.cfg.DrainGrace) + "replica", id, "after", grace) r.stopReplica(ctx, id) } }