Commit ee1e212
feat(janitor): onboard ExtRR to node-level locking
ExtRR now participates in the cross-controller node-level lock shared by
RebootNode / TerminateNode / GPUReset. Without this, fault-remediation
could create an ExtRR for a node already being acted on by another
maintenance resource (or vice-versa), producing overlapping handoffs.
Behavior:
* reconcileApply acquires the lock after fetching the Node, before any
Node mutation. Contention requeues with the 2s cadence the siblings
use. The drift branch explicitly releases the lock (terminal failure;
we never owned the taint).
* reconcileCleanupAfterComplete (branch 4) releases the lock once
Complete=True is observed — the external system finished, the Node is
back in NVSentinel's hands. CheckUnlock is idempotent so subsequent
no-op cleanup reconciles don't churn it.
* reconcileCleanupOnDeletion (branch 2) releases the lock explicitly
before finalizer removal. K8s GC via the lease's ownerReference covers
the failure case, but the explicit unlock matches the sibling pattern
and shortens the window where the lease could outlive its owner.
Wiring:
* New `NodeLock` + `LockNamespace` fields on the reconciler.
* main.go passes `LockNamespace: podNamespace` (matches siblings).
* SetupWithManager initialises `distributedlock.NewNodeLock(...)` when
unset, so tests can inject their own.
* New kubebuilder RBAC marker for `coordination.k8s.io/leases`.
Adds an envtest spec that pre-creates a lease with a foreign owner and
asserts the apply path requeues with `nodeLockRequeue` and the Node
stays untouched.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1319eeb commit ee1e212
3 files changed
Lines changed: 93 additions & 4 deletions
File tree
- janitor
- pkg/controller
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
244 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
| |||
Lines changed: 38 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
82 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
| |||
112 | 115 | | |
113 | 116 | | |
114 | 117 | | |
| 118 | + | |
115 | 119 | | |
116 | 120 | | |
117 | 121 | | |
| |||
267 | 271 | | |
268 | 272 | | |
269 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
270 | 277 | | |
271 | 278 | | |
272 | 279 | | |
273 | 280 | | |
274 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
275 | 288 | | |
276 | 289 | | |
277 | 290 | | |
| |||
289 | 302 | | |
290 | 303 | | |
291 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
292 | 312 | | |
293 | 313 | | |
294 | 314 | | |
295 | 315 | | |
296 | 316 | | |
297 | 317 | | |
298 | 318 | | |
| 319 | + | |
| 320 | + | |
299 | 321 | | |
300 | 322 | | |
301 | 323 | | |
| |||
400 | 422 | | |
401 | 423 | | |
402 | 424 | | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
403 | 429 | | |
404 | 430 | | |
405 | 431 | | |
| |||
425 | 451 | | |
426 | 452 | | |
427 | 453 | | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
428 | 460 | | |
429 | 461 | | |
430 | 462 | | |
| |||
635 | 667 | | |
636 | 668 | | |
637 | 669 | | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
638 | 674 | | |
639 | 675 | | |
640 | 676 | | |
| |||
Lines changed: 52 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| 58 | + | |
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
| |||
819 | 822 | | |
820 | 823 | | |
821 | 824 | | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
822 | 874 | | |
823 | 875 | | |
824 | 876 | | |
| |||
0 commit comments