From 35994a475c374f2da53ad6c127d7078092e58e64 Mon Sep 17 00:00:00 2001 From: Ye Sijun Date: Wed, 20 Apr 2022 18:03:43 +0800 Subject: [PATCH] fix monitor restart Signed-off-by: Ye Sijun --- runtime/restart/monitor/monitor.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/restart/monitor/monitor.go b/runtime/restart/monitor/monitor.go index 5a8e5622d..d829e9605 100644 --- a/runtime/restart/monitor/monitor.go +++ b/runtime/restart/monitor/monitor.go @@ -232,14 +232,17 @@ func (m *monitor) monitor(ctx context.Context) ([]change, error) { } } - // Task or Status return error, only desired to stop + // Task or Status return error, only desired to running if err != nil { logrus.WithError(err).Error("monitor") - if desiredStatus != containerd.Stopped { + if desiredStatus == containerd.Stopped { continue } } + // Known issue: + // The status may be empty when task failed but was deleted, + // which will result in an `on-failure` restart policy reconcile error. switch desiredStatus { case containerd.Running: if !restart.Reconcile(status, labels) {