Add check for CNI plugins before tearing down pod network

Signed-off-by: Sameer <sameer.saeed@live.ca>
This commit is contained in:
Sameer 2024-09-26 16:06:27 -04:00
parent db97449598
commit b7b6b324b8

View File

@ -111,9 +111,11 @@ func (c *criService) stopPodSandbox(ctx context.Context, sandbox sandboxstore.Sa
} else if closed {
sandbox.NetNSPath = ""
}
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)
}