Skip to content

Make drain package reusable for controller-runtime based callers - #1130

Open
acumino wants to merge 1 commit into
gardener:masterfrom
acumino:enh-drain-reuse
Open

Make drain package reusable for controller-runtime based callers#1130
acumino wants to merge 1 commit into
gardener:masterfrom
acumino:enh-drain-reuse

Conversation

@acumino

@acumino acumino commented Aug 3, 2026

Copy link
Copy Markdown
Member

/kind enhancement

What this PR does / why we need it:
This PR extends the drain Options API to support callers (e.g. Gardener) that do not run client-go informers and need to plug in their own pod source or customize pod selection.

  • Add PodProvider interface (PodsForNode) and SetPodProvider setter — allows callers to supply pods via a controller-runtime client instead of a pod lister/informer.
  • Add AdditionalPodFilters field — caller-supplied predicates evaluated alongside the built-in drain filters.
  • Add SkipVolumeHandling flag — skips PV detach/reattach during eviction, independent of ForceDeletePods.
  • Make podSynced cache-sync conditional — skipped when no informer is running (podSynced == nil).
  • Make pdbLister nil-safe so callers that don't set one don't panic.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

The drain package now exposes a `PodProvider` interface, `AdditionalPodFilters`, `SkipVolumeHandling`, and a nil-safe `pdbLister` guard, allowing external controllers (e.g. Gardener) to reuse the drain logic without running a client-go informer stack.

@acumino
acumino requested a review from a team as a code owner August 3, 2026 09:24
@gardener-prow

gardener-prow Bot commented Aug 3, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kon-angelo for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gardener-prow gardener-prow Bot added do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. labels Aug 3, 2026
@acumino

acumino commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

/kind enhancement

@gardener-prow gardener-prow Bot added kind/enhancement Enhancement, improvement, extension and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Aug 3, 2026
@gardener gardener deleted a comment from gardener-prow Bot Aug 3, 2026
@takoverflow

Copy link
Copy Markdown
Member

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/enhancement Enhancement, improvement, extension size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants