Merge pull request #10839 from matteopulcini6/sandbox-deferring-teardown-main

Handle teardown failure to avoid blocking cleanup
This commit is contained in:
Phil Estes
2024-10-16 15:54:56 +00:00
committed by GitHub

View File

@@ -220,6 +220,11 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
// Teardown network if an error is returned.
if cleanupErr = c.teardownPodNetwork(deferCtx, sandbox); cleanupErr != nil {
log.G(ctx).WithError(cleanupErr).Errorf("Failed to destroy network for sandbox %q", id)
// ignoring failed to destroy networks when we failed to setup networks
if sandbox.CNIResult == nil {
cleanupErr = nil
}
}
}