The pod worker may recieve a new pod which is marked as terminal in the runtime cache. This can occur if a pod is marked as terminal and the kubelet is restarted. The kubelet needs to drive these pods through the termination state machine. If upon restart, the kubelet receives a pod which is terminal based on runtime cache, it indicates that pod finished `SyncTerminatingPod`, but it did not complete `SyncTerminatedPod`. The pod worker needs ensure that `SyncTerminatedPod` will run on these pods. To accomplish this, set `finished=False`, on the pod sync status, to drive the pod through the rest of the state machine. This will ensure that status manager and other kubelet subcomponents (e.g. volume manager), will be aware of this pod and properly cleanup all of the resources of the pod after the kubelet is restarted. While making change, also update the comments to provide a bit more background around why the kubelet needs to read the runtime pod cache for newly synced terminal pods. Signed-off-by: David Porter <david@porter.me>
73 KiB
73 KiB