Skip to content

controller: drain: extract node taint and pod drain primitives - #99

Merged
pfl merged 1 commit into
intel:mainfrom
tkatila:drain_restruct
Aug 31, 2026
Merged

controller: drain: extract node taint and pod drain primitives#99
pfl merged 1 commit into
intel:mainfrom
tkatila:drain_restruct

Conversation

@tkatila

@tkatila tkatila commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/controller/drain.go Outdated
Comment thread internal/controller/drain.go
Comment thread internal/controller/gpufirmwareupdate_controller.go Outdated
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>
@pfl
pfl merged commit d90d8b3 into intel:main Aug 31, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants