Commit 36ee3c1
committed
cache: recover from PVC-informer race in addPod
A Pod ADD event can reach the scheduler before its referenced PVC ADD
reaches the PVC informer — for example when a Pod is created together
with an OnDemand PVC in quick succession (Spark's k8s scheduler-backend
does exactly this for executor pods with `claimName=OnDemand`).
Since v1.15.0, the resulting `looking up PVC ... not found` error from
NewTaskInfo permanently strands the pod:
addPod → NewTaskInfo → addPodCSIVolumesToTask
→ pvcInformer.Lister().Get(pvcName) returns not-found
→ klog.Errorf(...)
→ sc.resyncTask(pi) // enqueues taskKey into errTasks
→ return err // task never enters sc.Jobs
processResyncTask → errTasks.Get() → parseErrTaskKey → getTaskByUID
→ "failed to find task <uid>"
→ errTasks.Forget(taskKey) // permanent
→ return // never reaches retryResyncTask
There is no PVC-informer AddFunc that re-queues stuck pods, and the
pod's resourceVersion never advances before scheduling, so
`UpdatePod → deletePod + addPod` never fires. Executor pods stay
Pending; the PVC stays Pending with `WaitForPodScheduled`.
Before volcano-sh#5058, `addPod`'s error branch fell through to `sc.addTask(pi)`
even after `NewTaskInfo` returned an error, so the incomplete task
lived in `sc.Jobs` and processResyncTask could find it by UID on the
next tick and call syncTask, which refetches the pod from the apiserver
— by which point the PVC informer has synced. volcano-sh#5058 added a DRA-specific
happy path using the correct `addTask + resyncTask + return nil`
pattern, but also added a generic `return err` that removed the
implicit recovery for PVC-not-found.
Extend the DRA branch to PVC-not-found errors, using the same pattern.
Change getPodCSIVolumes to wrap the lister error with %w so callers
can classify it with errors.Is / apierrors.IsNotFound instead of
matching on the message string.
Adds `TestAddPodWithUnresolvedPVCCachesTaskForResync` mirroring the
existing DRA counterpart.
Version scope: only v1.15.0 is affected. Verified with
`git merge-base --is-ancestor 5ba79f3 <tag>` — every v1.14.x tag
through v1.14.3 (released after v1.15.0) is clean; v1.15.0-alpha.0 is
also clean.
Signed-off-by: Gustavo Parcianello <gustavo.parcianello@sap.com>1 parent e4f12cb commit 36ee3c1
3 files changed
Lines changed: 144 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
167 | 174 | | |
168 | 175 | | |
169 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
133 | 138 | | |
134 | 139 | | |
135 | 140 | | |
| |||
271 | 276 | | |
272 | 277 | | |
273 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
274 | 289 | | |
275 | 290 | | |
276 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
0 commit comments