sandbox: remove sandboxStore from podsandbox

Signed-off-by: Abel Feng <fshb1988@gmail.com>
This commit is contained in:
Abel Feng
2023-10-23 15:54:24 +08:00
parent 781d027ba8
commit 7dadd5f1bf
19 changed files with 473 additions and 302 deletions

View File

@@ -25,6 +25,7 @@ import (
"github.com/containerd/log"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
"github.com/containerd/containerd/v2/errdefs"
sandboxstore "github.com/containerd/containerd/v2/pkg/cri/store/sandbox"
)
@@ -74,7 +75,12 @@ func (c *criService) stopPodSandbox(ctx context.Context, sandbox sandboxstore.Sa
}
if err := controller.Stop(ctx, id); err != nil {
return fmt.Errorf("failed to stop sandbox %q: %w", id, err)
// Log and ignore the error if controller already removed the sandbox
if errdefs.IsNotFound(err) {
log.G(ctx).Warnf("sandbox %q is not found when stopping it", id)
} else {
return fmt.Errorf("failed to stop sandbox %q: %w", id, err)
}
}
}