Repository navigation
fix: do not submit a pod deleted while its volumes are resolved - #592
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
✅ Deploy Preview for interlink-dev canceled.
|
remoteExecutionHandleVolumes waits up to 5 minutes for a missing ConfigMap or Secret before the pod is submitted, with the pod in Initializing. Deleting the pod meanwhile drops it from p.pods (DeletePod has nothing to ask the plugin for), but the wait kept polling: once the object showed up the deleted pod was submitted anyway, leaving a remote job that nothing tracks or deletes, and otherwise a Failed status was reported for it after 5 minutes. The guard meant for this did not work either. The pod lookup before the wait only logged "Deleted Pod before actual creation" and returned nil, so RemoteExecution went on and submitted the deleted pod without its volumes, while CreatePod compared the error string against a message nothing returns anymore. Introduce errPodDeletedBeforeCreation and use it for both cases: - the initial lookup returns it when the pod is NotFound; other errors are logged and the volumes are still resolved instead of skipped; - the wait returns it after a retry once the pod is no longer tracked in p.pods, the check waitForKeptInitContainers already relies on; - CreatePod matches it with errors.Is, so such a pod is neither submitted nor marked failed. The retry interval becomes volumeRetryInterval so the tests can shorten it, as keptInitPollInterval and statusLoopInterval already are. Fixes interlink-hq#591 Signed-off-by: NopeCharon <[email protected]>
NopeCharon
force-pushed
the
fix/volume-wait-deleted-pod
branch
from
October 25, 2026 10:52
3d9311e to
80c63c0
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
If a pod is deleted while the virtual kubelet is still waiting for one of its ConfigMap/Secret volumes, it still gets submitted to the plugin once the object shows up. The VK no longer tracks it, so the remote job (e.g. a Slurm allocation) keeps running and nothing deletes it. One way to hit this: a pod has a typo in a ConfigMap name and sits in
Initializing. The user deletes it, creates the ConfigMap, and recreates the pod. That gives two jobs, one of them orphaned.The volume wait in
remoteExecutionHandleVolumesnever checked whether the pod still existed. The check before the wait only loggedDeleted Pod before actual creationand returnednil, so the deleted pod was submitted right away without its volumes.CreatePodwas looking for an error string that nothing returns anymore.This PR:
errPodDeletedBeforeCreationand matches it witherrors.IsinCreatePod, in place of the string comparison. Such a pod is not submitted and is not marked failed. The warning log matches the one for kept init containers.p.pods, the same checkwaitForKeptInitContainersuses.DeletePoddrops a pod that is still waiting there: the remote delete is skipped for anInitializingpod, and a plugin delete for a pod it never received succeeds (the Slurm plugin just removes a missing directory).volumeRetryIntervalso the tests can shorten it, likekeptInitPollIntervalandstatusLoopInterval.Tests:
TestRemoteExecutionHandleVolumesPodDeletedBeforeCreation: a pod that is gone from the API is reported as deleted.TestRemoteExecutionHandleVolumesWaitingForConfigMap: a tracked pod is still submitted once its ConfigMap appears, and a pod removed fromp.podsmid-wait stops waiting without its volume.Without the change, the first test gets
niland the deleted-pod subtest is still waiting when its 2s timeout hits.go test -race ./pkg/...(the wait tests also with-count=30) andgolangci-lint run(v2.14.0, as in CI) pass.Related issue : #591