5 Commits
Author SHA1 Message Date
2078e740f9 feat: add per-application driver PodDisruptionBudget (#2949) (#2954)
* feat: optional PodDisruptionBudget for Spark drivers (#2949)

Refs: https://github.com/kubeflow/spark-operator/issues/2949

Add an opt-in PodDisruptionBudget for the driver pod so a voluntary
eviction (e.g. `kubectl drain`) cannot kill the driver mid-job. The
apiserver's eviction admission handler consults a matching PDB; without
one the eviction is admitted and the operator only learns of it after
the fact via its watch. A PDB is the only lever the operator has here
that does not put it on the eviction hot path.

Gated twice, off by default so upgrades are no-op:
  --enable-driver-pdb              controller flag (default false)
  spec.driverPodDisruptionBudget   per-app *bool (nil/false = no PDB)

A bare *bool suffices: the driver is a singleton, so MinAvailable is
fixed at 1 and a selector struct has nothing to grow into.

Lifecycle (driver_pdb.go):
  - ensureDriverPDB converges PDB existence to spec on every
    Submitted/Running reconcile, so it recovers from operator restart
    with the gate flipped on, live spec edits, and transient API
    failures (retry.RetryOnConflict + controller-runtime backoff).
  - createDriverPDB/deleteDriverPDB read the cache first for
    idempotency; AlreadyExists/NotFound are treated as success.
  - The PDB carries a controller OwnerReference plus
    LabelLaunchedBySparkOperator + LabelSparkAppName, so kube GC reaps
    it on app deletion and the cache informer can filter to owned PDBs.
  - cleanUpOnTermination deletes the PDB on Completed/Failed; the
    terminal-app reconcile re-runs it to reap PDBs orphaned when the
    controller itself was drained mid-transition.
  - deleteSparkResources drops the PDB before the driver pod so an
    in-flight external drain does not block on a stale PDB.

RBAC: the PDB entry in cache.Options.ByObject starts an informer, which
needs list+watch even though the code only Get/Create/Deletes. Granted
get;list;watch;create;delete on poddisruptionbudgets via the kubebuilder
marker (regenerated config/rbac/role.yaml), the Helm chart helper, and
the chart rbac unit test. Missing verbs would loop the informer on
Forbidden and saturate the shared client rate limiter.

Helm: controller.driverPodDisruptionBudget.enable (default false) emits
--enable-driver-pdb=true; ci-values.yaml turns it on for e2e.

Tests: envtest specs cover the gate matrix and the convergence cases
ensureDriverPDB owns (restart-with-gate-on, spec false->true and
true->false on a running app, transient Create failure retried via an
interceptor.Funcs client). E2e submits real apps with the field set and
omitted and asserts PDB creation, GC on deletion, and absence when not
opted in.

Makefile: kind-load-spark-image preloads the Spark runtime image and
e2e-test pins IMAGE_TAG=local with the load targets as prerequisites, so
`make deploy` and `make e2e-test` are self-contained on a local Kind
cluster instead of hitting ImagePullBackOff.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Vincent Janelle <randomfrequency@gmail.com>

* test: use events.FakeRecorder in driver PDB test

NewReconciler takes an events.EventRecorder, not the legacy
record.EventRecorder. Align driver_pdb_test.go with controller_test.go.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Vincent Janelle <randomfrequency@gmail.com>

* allow for kustomize to patch pdb value; default to true in ci
Signed-off-by: Vincent Janelle <randomfrequency@gmail.com>

---------

Signed-off-by: Vincent Janelle <randomfrequency@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-06-30 20:28:48 +00:00
Shingo OmuraandGitHub e2ee1635c1 Bump k8s to v1.35.4 and controller-runtime to v0.23.3 (#2946)
* Bump k8s api to 0.35.4, and controller runtime to v0.23.3

Signed-off-by: Shingo Omura <everpeace@gmail.com>

* Migrated defaulter/validator to be Generic ones

Signed-off-by: Shingo Omura <everpeace@gmail.com>

* Fixed Endpoints deprecation lint errors (replaced with EndpointSlice)

Signed-off-by: Shingo Omura <everpeace@gmail.com>

* Deleted unused internal/controller/sparkapplication/validator.go

Signed-off-by: Shingo Omura <everpeace@gmail.com>

* Add SA1019 exclusion to golangci-lint config so to preserve Requeue behavior of controllers

Signed-off-by: Shingo Omura <everpeace@gmail.com>

* Fixed util.WriteObjectToFile test. Null creationTimestamp is not marshalled anymore.

Signed-off-by: Shingo Omura <everpeace@gmail.com>

* Updated codegen and API definitions

Signed-off-by: Shingo Omura <everpeace@gmail.com>

* Fixed mgr.GetEventRecorderFor() deprecation (replace with mgr.GetEventRecorder())

Signed-off-by: Shingo Omura <everpeace@gmail.com>

---------

Signed-off-by: Shingo Omura <everpeace@gmail.com>
2026-06-18 15:36:34 +00:00
Vara BonthuandGitHub 610ec74d9d Release v2.5.0-rc.0 (#2854)
Signed-off-by: vara-bonthu <vara.bonthu@gmail.com>
2026-03-02 02:14:03 +00:00
Tariq HasanandGitHub 69d728aa0f chore(api): bump Python API version to 2.4.0 (#2853)
Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>
2026-02-27 18:27:16 +00:00
Tariq HasanandGitHub 2ed985ba8a feat: add Python API generation for Spark Operator CRDs (#2828)
* feat: enable and generate OpenAPI schemas for SparkOperator APIs

Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>

* feat: add tooling to generate and validate OpenAPI spec

Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>

* feat: add generated OpenAPI spec for Spark Operator

Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>

* feat: add tooling to generate Python client from OpenAPI spec

Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>

* feat: add generated Python client for Spark Operator APIs

Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>

* fix: align code generation with Trainer patterns

Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>

* fix: align Spark swagger naming and Python SDK generation

Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>

* docs: recommend isolated Python environments for SDK publishing

Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>

* fix: generate Python SDK models for v1alpha1 and v1beta2 APIs

Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>

---------

Signed-off-by: tariq-hasan <mmtariquehsn@gmail.com>
2026-02-11 14:52:15 +00:00