From 2474a99c3084aa2c2239a827130c1972bf7724c5 Mon Sep 17 00:00:00 2001 From: Danny Canter Date: Sat, 30 Mar 2024 21:20:22 -0700 Subject: [PATCH] Add IsNotFound case to ListPodSandboxStats Fixes #10013. It seems we can end up in a spot where the sandbox store still has a listing for a pod, whereas containerds underlying store has removed it. It might be better to shield the caller (k8s) from these transient errors. Signed-off-by: Danny Canter --- internal/cri/server/sandbox_stats_list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cri/server/sandbox_stats_list.go b/internal/cri/server/sandbox_stats_list.go index a4f9f826f..0dbdca50f 100644 --- a/internal/cri/server/sandbox_stats_list.go +++ b/internal/cri/server/sandbox_stats_list.go @@ -39,7 +39,7 @@ func (c *criService) ListPodSandboxStats( for _, sandbox := range sandboxes { sandboxStats, err := c.podSandboxStats(ctx, sandbox) switch { - case errdefs.IsUnavailable(err): + case errdefs.IsUnavailable(err), errdefs.IsNotFound(err): log.G(ctx).WithField("podsandboxid", sandbox.ID).Debugf("failed to get pod sandbox stats, this is likely a transient error: %v", err) case err != nil: errs = append(errs, fmt.Errorf("failed to decode sandbox container metrics for sandbox %q: %w", sandbox.ID, err))