Merge pull request #6833 from Junnplus/monitor-restart

fix the restart desired to running when task not found
This commit is contained in:
Phil Estes 2022-04-20 18:09:22 +01:00 committed by GitHub
commit 1a236784dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 { if err != nil {
logrus.WithError(err).Error("monitor") logrus.WithError(err).Error("monitor")
if desiredStatus != containerd.Stopped { if desiredStatus == containerd.Stopped {
continue 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 { switch desiredStatus {
case containerd.Running: case containerd.Running:
if !restart.Reconcile(status, labels) { if !restart.Reconcile(status, labels) {