Xpumd restart functionality - #119
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Tuomas Katila <tuomas.katila@intel.com>
4fcba52 to
019531b
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new controller introduces a potentially expensive cluster-wide ResourceSlice listing per reconcile and includes a misleading RBAC comment that should be corrected before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR introduces an XPU Manager (xpumd) “device refresh” controller that compares the GPUs visible to each xpumd Pod vs. the node’s currently published/usable GPUs (via DRA ResourceSlices) and deletes the Pod to force recreation when a restart is needed to pick up recovered/rebound devices. It also adds a new spec.xpu.restartOnDeviceRecovery ClusterPolicy setting (and Helm/CRD/docs plumbing) to control whether restarts happen on recovery-only, always-on rebind, or are disabled.
Changes:
- Add
XpumDeviceRefreshReconcilerto adopt xpumd Pods (record device set) and restart Pods based on DRA ResourceSlice/device state. - Add comprehensive envtest coverage for adoption, missing-device restarts, rebind handling, and restart guards.
- Expose/configure the feature via ClusterPolicy API/CRD, Helm chart values/templates, RBAC, and documentation.
File summaries
| File | Description |
|---|---|
| README.md | Documents the new spec.xpu.restartOnDeviceRecovery knob. |
| internal/controller/xpum_device_refresh.go | Implements the new xpumd device refresh controller. |
| internal/controller/xpum_device_refresh_test.go | Adds envtest coverage for the controller’s behavior and guardrails. |
| config/rbac/namespaced_role.yaml | Grants namespaced Pod patch permission for writing the device record annotation. |
| config/crd/bases/intel.com_clusterpolicies.yaml | Adds CRD schema/default/enum for restartOnDeviceRecovery. |
| cmd/main.go | Registers the new controller with the manager. |
| charts/gpu-base-operator/templates/namespaced_role.yaml | Helm template update to include Pod patch in the namespaced Role. |
| charts/gpu-base-operator/crds/clusterpolicies.yaml | Helm CRD bundle update mirroring the CRD schema change. |
| charts/gpu-base-operator-policy/values.yaml | Adds Helm values default for xpu.restartOnDeviceRecovery. |
| charts/gpu-base-operator-policy/templates/clusterpolicy.yaml | Wires the Helm value into the rendered ClusterPolicy. |
| charts/gpu-base-operator-policy/README.md | Documents the new Helm value. |
| api/v1alpha1/clusterpolicy_types.go | Adds the RestartOnDeviceRecovery field + XpumRestartMode type/constants. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A container is given its GPU device nodes at creation. An xpumd container that started while one of its node's GPUs was in survivability mode therefore monitors every GPU on that node except that one. When the GPU is recovered from survivability mode, xpumd has to be restarted so that is can observe the newly detectable device. The restart logic is tied to the ClusterPolicy's xpu.restartOnDeviceRecovery. Similar to the recovery functionality, it is dependant on using DRA and its ResourceSlices. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Tuomas Katila <tuomas.katila@intel.com>
019531b to
3644ebc
Compare
If GPUs are in survivability mode (or are rebound to different indices), xpumd's observed GPUs would be incorrect. Xpumd cannot currently do anything about itself. A container restart will not update the GPUs assigned to the Pod. A Pod restart/recreation is needed.
xpumd device refresh controller tries to understand changes in the devices in the DRA's resourceslices vs. xpumd's allocation. Depending on how the controller is configured, it will either restart the Pod on any rebind action, on missing devices, or never.