Skip to content

Commit 278bd0f

Browse files
committed
[release/1.7] Add check for CNI plugins before tearing down pod network
Signed-off-by: Sameer <[email protected]>
1 parent 7f7fdf5 commit 278bd0f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

pkg/cri/server/sandbox_stop.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ func (c *criService) stopPodSandbox(ctx context.Context, sandbox sandboxstore.Sa
104104
} else if closed {
105105
sandbox.NetNSPath = ""
106106
}
107-
if err := c.teardownPodNetwork(ctx, sandbox); err != nil {
108-
return fmt.Errorf("failed to destroy network for sandbox %q: %w", id, err)
107+
if sandbox.CNIResult != nil {
108+
if err := c.teardownPodNetwork(ctx, sandbox); err != nil {
109+
return fmt.Errorf("failed to destroy network for sandbox %q: %w", id, err)
110+
}
109111
}
110112
if err := sandbox.NetNS.Remove(); err != nil {
111113
return fmt.Errorf("failed to remove network namespace for sandbox %q: %w", id, err)

0 commit comments

Comments
 (0)