Merge pull request #10451 from dims/cri-ttrpc-closed-during-ListPodSandboxStats-main
Fix for [cri] ttrpc: closed during ListPodSandboxStats
This commit is contained in:
commit
231301c8f8
@ -24,6 +24,7 @@ import (
|
|||||||
sandboxstore "github.com/containerd/containerd/v2/internal/cri/store/sandbox"
|
sandboxstore "github.com/containerd/containerd/v2/internal/cri/store/sandbox"
|
||||||
"github.com/containerd/errdefs"
|
"github.com/containerd/errdefs"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
"github.com/containerd/ttrpc"
|
||||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,6 +42,8 @@ func (c *criService) ListPodSandboxStats(
|
|||||||
switch {
|
switch {
|
||||||
case errdefs.IsUnavailable(err), errdefs.IsNotFound(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)
|
log.G(ctx).WithField("podsandboxid", sandbox.ID).Debugf("failed to get pod sandbox stats, this is likely a transient error: %v", err)
|
||||||
|
case errors.Is(err, ttrpc.ErrClosed):
|
||||||
|
log.G(ctx).WithField("podsandboxid", sandbox.ID).Debugf("failed to get pod sandbox stats, connection closed: %v", err)
|
||||||
case err != nil:
|
case err != nil:
|
||||||
errs = append(errs, fmt.Errorf("failed to decode sandbox container metrics for sandbox %q: %w", sandbox.ID, err))
|
errs = append(errs, fmt.Errorf("failed to decode sandbox container metrics for sandbox %q: %w", sandbox.ID, err))
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user