You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ee582af
Browse filesBrowse the repository at this point in the historyBrowse files
fix(drain-plan): follow the Eviction API's budget rules; review follow-ups
Budget evaluation now reproduces the API server's eviction handler:
Pending and terminating pods bypass PodDisruptionBudgets; a pod covered by
more than one budget is reported as may-block (the eviction subresource
refuses it); an unready pod is evictable under unhealthyPodEvictionPolicy
AlwaysAllow, or under IfHealthyBudget when currentHealthy >= desiredHealthy;
a budget whose status is not reconciled yet (observedGeneration < generation)
is reported as may-block, because the API server answers 429 until it is.
PlanNodeDrain lists budgets only for namespaces holding a pod whose decision
depends on them, so a forbidden namespace with nothing but skipped pods no
longer marks the plan as unevaluated; pdbChecked is set only when a decision
reached the budget check.
Frontend: the drain stays disabled after a plan request error; the plan
request goes through apiUrl(); the plan mutation carries the toast metadata
the app's mutation handler expects; the emptyDir acknowledgement uses the
themed AlertBanner instead of a hardcoded colour. Comment and log-format
nits from review.
returnnames[0], fmt.Sprintf("covered by %d PodDisruptionBudgets (%s); the Eviction API refuses pods covered by more than one budget", len(matched), strings.Join(names, ", ")), true
returnname, fmt.Sprintf("PodDisruptionBudget %s has not been reconciled yet (observedGeneration %d < generation %d); evictions are refused until its status is up to date", name, p.Status.ObservedGeneration, p.Generation), true
180
+
}
181
+
ifp.Status.DisruptionsAllowed<=0 {
182
+
returnname, fmt.Sprintf("PodDisruptionBudget %s currently allows no disruptions; the eviction may be refused until the budget recovers", name), true
183
+
}
184
+
return"", "", false
119
185
}
120
186
121
187
// DrainPlanOptions echoes the options a plan was evaluated with, so the caller never has to
@@ -150,8 +216,9 @@ type DrainPlan struct {
150
216
151
217
// PlanNodeDrain lists the pods on nodeName and classifies each one with ClassifyPodForDrain.
152
218
// It performs only reads with the given client, so it runs under the caller's RBAC identity and
153
-
// never cordons or evicts. PDBs are listed per namespace; a namespace whose PDBs cannot be read
154
-
// is classified without PDB knowledge and reported as such instead of pretending no PDB exists.
219
+
// never cordons or evicts. PDBs are listed per namespace and only for namespaces holding pods
220
+
// whose decision depends on them; a namespace whose PDBs cannot be read is classified without
221
+
// PDB knowledge and reported as such instead of pretending no PDB exists.
0 commit comments