fix(host): restart container on exit when AlwaysRestart is set (#24662)

This commit is contained in:
Zexi Li
2026-04-10 15:17:35 +08:00
committed by GitHub
parent 25e479ffc4
commit c6fe02c95d
+1 -1
View File
@@ -78,7 +78,7 @@ func (m *SGuestManager) reconcileContainer(obj *sPodGuestInstance, cache runtime
// container is deleted
continue
}
if cs.State == runtime.ContainerStateExited && cs.ExitCode != 0 {
if cs.State == runtime.ContainerStateExited && (cs.ExitCode != 0 || ctr.Spec.AlwaysRestart) {
if err := m.startContainer(obj, ctr, cs); err != nil {
errs = append(errs, errors.Wrapf(err, "start container %s", ctr.Name))
}