Skip to content

Create an event when drain is blocked by a PBD - #296

Open
alicefr wants to merge 4 commits into
bootc-dev:mainfrom
alicefr:event-pbd
Open

alicefr wants to merge 4 commits into
bootc-dev:mainfrom
alicefr:event-pbd

Conversation

@alicefr

@alicefr alicefr commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

A node drain can stall forever when a PodDisruptionBudget (PDB) allows no evictions. Today the user sees only a generic DrainTakingTooLong event, with no hint about the cause.
When a drain passes the stall threshold (5 minutes by default), the controller now:

  • reads the pods the drain would evict and the live PDBs, and finds the budgets blocking them
  • emits a DrainBlockedByPDB warning on the BootcNode naming each PDB and why it blocks (N pod(s) not ready, never allows eviction, or multiple PDBs selecting one pod). The event is re-emitted only when the blocking set changes.
  • sets pool UpToDate=False with reason PDBBlocked when every occupied reboot slot is held by a blocked drain. If only some slots are blocked, the reason stays RolloutInProgress and the message names the node and PDB. Priority is Paused > PDBBlocked > RolloutInProgress.
  • rechecks every 30s while a drain is stalled
    Rollout behavior is unchanged. This only adds reporting.
    The pod and PDB eligibility checks follow the eviction API: pending, terminal and terminating pods are skipped, the unhealthy-pod eviction policy is honored, and a pod matched by 2 or more PDBs is reported as a misconfiguration.

Extract the drain.Helper setup into a shared constructor so drain
diagnostics can inspect the same pod set the drainer uses. Also make the
drain stall threshold configurable on the reconciler so tests can use a
short threshold; the default remains five minutes.

Assisted-by: AI
Signed-off-by: Alice Frosi <afrosi@redhat.com>
When a drain stalls past the stall threshold, inspect the pods the drain
would evict and report the PodDisruptionBudgets that prevent eviction.
Emit a DrainBlockedByPDB event, re-emitting only when the set of
blocking budgets changes, and surface blocked nodes in the pool status
message.

When every occupied reboot slot is held by a blocked drain and the
rollout has consumed all of its disruption budget, report
UpToDate=False with reason PDBBlocked. Partial blocks keep the
RolloutInProgress reason so existing behavior is unchanged. Stalled
drains are rechecked every 30 seconds, and the controller now has
permission to get and list PodDisruptionBudgets.

Assisted-by: AI
Signed-off-by: Alice Frosi <afrosi@redhat.com>
Add an operations section covering the DrainBlockedByPDB event, the
PDBBlocked UpToDate reason, and how to resolve each hint.

Add the PDBBlocked reason to the architecture condition table.

Assisted-by: AI
Signed-off-by: Alice Frosi <afrosi@redhat.com>
Run a single-replica application with a zero disruption budget on a
one-node pool and start a rollout. Verify the controller reports the
blocking budget through a DrainBlockedByPDB event and the PDBBlocked
pool condition while the node stays cordoned and does not reboot. Then
relax the budget and verify the drain and rollout complete.

Assisted-by: AI
Signed-off-by: Alice Frosi <afrosi@redhat.com>

This branch has not been deployed

No deployments
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.

1 participant