feat: add per-application driver PodDisruptionBudget (#2949) #2954
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.50) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 633 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.386
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2954"
general
weight: 0.35
vjanelle
Purpose of this PR
Adds an opt-in per-
SparkApplicationdriver PodDisruptionBudget (PDB) sooperators can prevent voluntary disruption (node drains, autoscaler
evictions) of long-running drivers without resorting to cluster-wide
policy.
The feature is gated on two switches that both default to off, so the
change is a no-op for installations that do not opt in:
1. A controller-level flag,
--enable-driver-pdb(chart valuecontroller.driverPodDisruptionBudget.enable), gives cluster operatorsa single permission point.
2. A per-application field,
spec.driverPodDisruptionBudget(bool),lets app authors opt in once the operator gate is open.
When both gates are true, the controller maintains a
policy/v1PodDisruptionBudget with
minAvailable: 1and amatchLabelsselectorthat targets the driver pod by name. The PDB is owner-referenced to the
SparkApplicationso it is GC'd at app deletion, and the reconcile loopalso cleans it up when the app reaches a terminal state or when the spec
is flipped back off.
PDB existence is converged on every non-terminal reconcile (Submitted and
Running state handlers), so:
controller-runtime backoff.
--enable-driver-pdbturned on retroactivelycreates PDBs for already-running apps that opted in.
spec.driverPodDisruptionBudgetfrom false to true (or trueto false) on a running app takes effect on the next reconcile cycle.
Proposed changes:
api/v1beta2): addSparkApplicationSpec.DriverPodDisruptionBudget bool,regenerate CRDs, deepcopy, OpenAPI, Python API, and chart CRDs.
internal/controller/sparkapplication): newdriver_pdb.gowith idempotent
ensureDriverPDB/createDriverPDB/deleteDriverPDBhelpers;
ensureDriverPDBwired into the Submitted and Running reconcilebranches; PDB cleanup in
cleanUpOnTermination.--enable-driver-pdb(default false), plumbed throughcmd/operator/controllerintoReconciler.Options.EnableDriverPDB.policy/poddisruptionbudgetscreate/get/list/watch/update/patch/deleteto the controller role (Helm and Kustomize, in sync).
controller.driverPodDisruptionBudget.enablevalue, gatedRBAC rule, and helper template that emits the
--enable-driver-pdbflag when set. Helm-unittest specs cover the on/off matrix.
driver_pdb_test.gocovering both gates,spec-flip lifecycle, terminal-state cleanup, OwnerReferences GC, and
reconcile-loop convergence after operator restart or spec flip; one
Ginkgo e2e spec in
test/e2e/pdb_test.goexercising the happy pathon Kind.
make deployloads the Spark runtime image into Kind alongside theoperator image, and
make e2e-testcreates the Kind cluster on demandinstead of assuming one exists.
Change Category
Rationale
A missing-driver event (node drain, autoscaler eviction, kubelet upgrade)
restarts the entire Spark application from scratch. For long-running
drivers this is an expensive failure mode that PDBs were designed to
prevent, but cluster-wide PDB policy is too blunt - most users want PDBs
only for opt-in drivers, not for every Spark driver in the cluster.
The two-gate design (operator flag plus per-app field) keeps the cluster
operator in control of whether the feature exists at all, while letting
individual app authors opt their long-running pipelines in. Defaulting
both gates to off avoids any behavior change for installations that do
not opt in.
Reconcile-loop convergence (rather than a one-shot create on submit)
keeps PDB state correct across operator restarts, transient API failures,
and spec edits - a missing PDB silently defeats the entire feature, so
the controller errs on the side of repeatedly ensuring it exists.
Checklist
Additional Notes
config/crd/basesandcharts/spark-operator-chart/crds, deepcopy, OpenAPI, Python API,api-docs.md) are committed.
make detect-crds-drift,make verify-codegen,make manifests,make helm-unittest,make kustomize-lint,make go-lint, andmake unit-testall pass.code, tests, and two Makefile chores that the e2e suite depends on.
DEPLOY_METHOD=helm.---
Co-authored with Claude Code.