Skip to content

Commit a9adc79

Browse files
committed
cri: PodSandboxStatus should tolerate missing task
Signed-off-by: Samuel Karp <[email protected]> (cherry picked from commit 8903986) Signed-off-by: Samuel Karp <[email protected]>
1 parent 6afbeac commit a9adc79

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

pkg/cri/server/sandbox_status.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,14 @@ func toCRISandboxInfo(ctx context.Context, sandbox sandboxstore.Sandbox) (map[st
155155

156156
var processStatus containerd.ProcessStatus
157157
if task != nil {
158-
taskStatus, err := task.Status(ctx)
159-
if err != nil {
160-
return nil, fmt.Errorf("failed to get task status: %w", err)
158+
if taskStatus, err := task.Status(ctx); err != nil {
159+
if !errdefs.IsNotFound(err) {
160+
return nil, fmt.Errorf("failed to get task status: %w", err)
161+
}
162+
processStatus = containerd.Unknown
163+
} else {
164+
processStatus = taskStatus.Status
161165
}
162-
163-
processStatus = taskStatus.Status
164166
}
165167

166168
si := &SandboxInfo{

0 commit comments

Comments
 (0)