Skip to content

Commit ca6516e

Browse files
committed
[release/1.6] Add check for CNI plugins before tearing down pod network
Signed-off-by: Sameer <[email protected]>
1 parent 88c3d9b commit ca6516e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/cri/server/sandbox_stop.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ func (c *criService) stopPodSandbox(ctx context.Context, sandbox sandboxstore.Sa
9898
} else if closed {
9999
sandbox.NetNSPath = ""
100100
}
101-
if err := c.teardownPodNetwork(ctx, sandbox); err != nil {
102-
return fmt.Errorf("failed to destroy network for sandbox %q: %w", id, err)
101+
if sandbox.CNIResult != nil {
102+
if err := c.teardownPodNetwork(ctx, sandbox); err != nil {
103+
return fmt.Errorf("failed to destroy network for sandbox %q: %w", id, err)
104+
}
103105
}
104106
if err := sandbox.NetNS.Remove(); err != nil {
105107
return fmt.Errorf("failed to remove network namespace for sandbox %q: %w", id, err)

0 commit comments

Comments
 (0)