Skip to content

Commit

Permalink
Merge pull request containerd#10744 from sameersaeed/sandbox-cni-plugins
Browse files Browse the repository at this point in the history
Add check for CNI plugins before tearing down pod network
  • Loading branch information
mxpv authored Sep 30, 2024
2 parents 363e50b + b7b6b32 commit 03db11c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/cri/server/sandbox_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ func (c *criService) stopPodSandbox(ctx context.Context, sandbox sandboxstore.Sa
} else if closed {
sandbox.NetNSPath = ""
}
if err := c.teardownPodNetwork(ctx, sandbox); err != nil {
return fmt.Errorf("failed to destroy network for sandbox %q: %w", id, err)
if sandbox.CNIResult != nil {
if err := c.teardownPodNetwork(ctx, sandbox); err != nil {
return fmt.Errorf("failed to destroy network for sandbox %q: %w", id, err)
}
}
if err := sandbox.NetNS.Remove(); err != nil {
return fmt.Errorf("failed to remove network namespace for sandbox %q: %w", id, err)
Expand Down

0 comments on commit 03db11c

Please sign in to comment.