• Dan Williams's avatar
    dockershim/sandbox: clean up pod network even if SetUpPod() failed · 91321ef8
    Dan Williams authored
    If the CNI network plugin completes successfully, but something fails
    between that success and dockerhsim's sandbox setup code, plugin resources
    may not be cleaned up. A non-trivial amount of code runs after the
    plugin itself exits and the CNI driver's SetUpPod() returns, and any error
    condition recognized by that code would cause this leakage.
    
    The Kubernetes CRI RunPodSandbox() request does not attempt to clean
    up on errors, since it cannot know how much (if any) networking
    was actually set up. It depends on the CRI implementation to do
    that cleanup for it.
    
    In the dockershim case, a SetUpPod() failure means networkReady is
    FALSE for the sandbox, and TearDownPod() will not be called later by
    garbage collection even though networking was configured, because
    dockershim can't know how far SetUpPod() got.
    
    Concrete examples include if the sandbox's container is somehow
    removed during during that time, or another OS error is encountered,
    or the plugin returns a malformed result to the CNI driver.
    
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1532965
    91321ef8
docker_sandbox_test.go 11.2 KB