From ae7cdc814b029493d213a63f3399b03bfb531ac9 Mon Sep 17 00:00:00 2001 From: Wei Fu Date: Sun, 3 May 2020 10:44:49 +0800 Subject: [PATCH] vendor: update containerd/cri Commit ID: 65830369b6b2b4edc454bf5cebbd9b76c1c1ac66 from master Signed-off-by: Wei Fu --- vendor.conf | 2 +- .../containerd/cri/pkg/server/sandbox_run.go | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/vendor.conf b/vendor.conf index 9b8b8b283..378988df5 100644 --- a/vendor.conf +++ b/vendor.conf @@ -56,7 +56,7 @@ gotest.tools/v3 bb0d8a963040ea5048dcef1a14d8 github.com/cilium/ebpf 4032b1d8aae306b7bb94a2a11002932caf88c644 # cri dependencies -github.com/containerd/cri dc7afe8fbe53db06c3f883f6f8c9895a9dfb2314 # master +github.com/containerd/cri 65830369b6b2b4edc454bf5cebbd9b76c1c1ac66 # master github.com/davecgh/go-spew 8991bc29aa16c548c550c7ff78260e27b9ab7c73 # v1.1.1 github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580 github.com/docker/docker 4634ce647cf2ce2c6031129ccd109e557244986f diff --git a/vendor/github.com/containerd/cri/pkg/server/sandbox_run.go b/vendor/github.com/containerd/cri/pkg/server/sandbox_run.go index 101f67ad5..becbf9e1b 100644 --- a/vendor/github.com/containerd/cri/pkg/server/sandbox_run.go +++ b/vendor/github.com/containerd/cri/pkg/server/sandbox_run.go @@ -123,12 +123,18 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox sandbox.NetNSPath = sandbox.NetNS.GetPath() defer func() { if retErr != nil { + // Teardown network if an error is returned. + if err := c.teardownPodNetwork(ctx, sandbox); err != nil { + log.G(ctx).WithError(err).Errorf("Failed to destroy network for sandbox %q", id) + } + if err := sandbox.NetNS.Remove(); err != nil { log.G(ctx).WithError(err).Errorf("Failed to remove network namespace %s for sandbox %q", sandbox.NetNSPath, id) } sandbox.NetNSPath = "" } }() + // Setup network for sandbox. // Certain VM based solutions like clear containers (Issue containerd/cri-containerd#524) // rely on the assumption that CRI shim will not be querying the network namespace to check the @@ -140,14 +146,6 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox if err := c.setupPodNetwork(ctx, &sandbox); err != nil { return nil, errors.Wrapf(err, "failed to setup network for sandbox %q", id) } - defer func() { - if retErr != nil { - // Teardown network if an error is returned. - if err := c.teardownPodNetwork(ctx, sandbox); err != nil { - log.G(ctx).WithError(err).Errorf("Failed to destroy network for sandbox %q", id) - } - } - }() } // Create sandbox container. @@ -328,10 +326,6 @@ func (c *criService) setupPodNetwork(ctx context.Context, sandbox *sandboxstore. sandbox.CNIResult = result return nil } - // If it comes here then the result was invalid so destroy the pod network and return error - if err := c.teardownPodNetwork(ctx, *sandbox); err != nil { - log.G(ctx).WithError(err).Errorf("Failed to destroy network for sandbox %q", id) - } return errors.Errorf("failed to find network info for sandbox %q", id) }