controller: drain: extract node taint and pod drain primitives - #99
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the GPUFirmwareUpdate controller’s node-drain logic into reusable primitives (taint management, GPU pod detection, and eviction) in preparation for an upcoming GPU recovery controller, and switches draining from direct Pod deletion to the Kubernetes Eviction API.
Changes:
- Extracted node tainting, pod selection (GPU-only and full-drain helpers), and eviction helpers into
internal/controller/drain.go. - Updated GPUFirmwareUpdate controller to use the shared drain primitives and retry evictions during drain polling.
- Added unit tests for the new drain primitives and granted RBAC permission for
pods/eviction.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/controller/gpufirmwareupdate_controller.go | Replaces inline taint/pod-drain logic with shared drain helpers and switches to eviction API usage. |
| internal/controller/gpufirmwareupdate_controller_test.go | Adjusts tests for new drain behavior and adds an assertion that non-GPU pods are not evicted. |
| internal/controller/drain.go | Introduces reusable taint, pod selection, and eviction primitives (GPU-only and full-node drain building blocks). |
| internal/controller/drain_test.go | Adds focused unit tests for drain primitives using a fake client and interceptors. |
| config/rbac/role.yaml | Adds create permission for pods/eviction. |
| charts/gpu-base-operator/templates/role.yaml | Mirrors RBAC pods/eviction permission in the Helm chart. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Upcoming GPU recovery controller needs similar functionality that exists in the GPU FW update controller now. Move drain functionality to its own file so it can be used from both controllers. This also moves the controller to use Eviction API instead of Pod Delete. Signed-off-by: Tuomas Katila <tuomas.katila@intel.com>
tkatila
force-pushed
the
drain_restruct
branch
from
August 31, 2026 07:51
2d2829c to
4136f90
Compare
pfl
approved these changes
Aug 31, 2026
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.
Upcoming GPU recovery controller needs similar functionality that exists in the GPU FW update controller now. Move drain functionality to its own file so it can be used from both controllers.
This also moves the controller to use Eviction API instead of Pod Delete.