Skip to content

Commit

Permalink
Add IsNotFound case to ListPodSandboxStats
Browse files Browse the repository at this point in the history
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 <danny@dcantah.dev>
(cherry picked from commit 2474a99)
Signed-off-by: Danny Canter <danny@dcantah.dev>
  • Loading branch information
dcantah committed Apr 5, 2024
1 parent 926c958 commit 90c309f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/cri/server/sandbox_stats_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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 = multierror.Append(errs, fmt.Errorf("failed to decode sandbox container metrics for sandbox %q: %w", sandbox.ID, err))
Expand Down

0 comments on commit 90c309f

Please sign in to comment.