Merge pull request #10023 from dcantah/liststats-notfound

Add IsNotFound case to ListPodSandboxStats
This commit is contained in:
Fu Wei 2024-04-02 12:46:35 +00:00 committed by GitHub
commit 4c5f2bce1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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))