mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Merge pull request #28160 from saad-ali/waitForGracefulTerm
Automatic merge from submit-queue Volume manager must verify containers terminated before deleting for ungracefully terminated pods A pod is removed from volume manager (triggering unmount) when it is deleted from the kubelet pod manager. Kubelet deletes the pod from pod manager as soon as it receives a delete pod request. As long as the graceful termination period is non-zero, this happens after kubelet has terminated all containers for the pod. However, when graceful termination period for a pod is set to zero, the volume is deleted from pod manager *before* its containers are terminated. This can result in volumes getting unmounted from a pod before all containers have exited when graceful termination is set to zero. This PR prevents that from happening by only deleting a volume from volume manager once it is deleted from the pod manager AND the kubelet containerRuntime status indicates all containers for the pod have exited. Because we do not want to call containerRuntime too frequently, we introduce a delay in the `findAndRemoveDeletedPods()` method to prevent it from executing more frequently than every two seconds. Fixes https://github.com/kubernetes/kubernetes/issues/27691 Running test in tight loop to verify fix.
This commit is contained in:
@@ -299,7 +299,8 @@ func newTestKubeletWithImageList(
|
||||
kubelet.hostname,
|
||||
kubelet.podManager,
|
||||
fakeKubeClient,
|
||||
kubelet.volumePluginMgr)
|
||||
kubelet.volumePluginMgr,
|
||||
fakeRuntime)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to initialize volume manager: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user