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) } }