Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions rust/operator-binary/src/spark_k8s_controller/build/pod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,16 @@ pub(crate) fn pod_template(

let mut metadata = omb.build();

// We explicitly remove the application owner reference from driver and executor pods.
// We explicitly remove the application owner reference from executor pods.
//
// The executors then only have the driver as owner and Kubernetes can garbage collect them
// early when the driver pod or the spark-submit job is deleted.
// Drivers must not have the SparkApplication as owner because this prevents proper cleanup
// when the application is finished.
// The submit pod doesn't use this function right now, but we keep the "if" below for future
// sanity.
if role == SparkApplicationRole::Executor || role == SparkApplicationRole::Driver {
//
// The driver keeps the SparkApplication as owner so that deleting the application cascades
// to the driver and, through it, to the executors. Without this, deleting the application
// orphans both roles for as long as the application does not reach a terminal phase, which
// never happens for streaming jobs.
if role == SparkApplicationRole::Executor {
metadata.owner_references = None;
}

Expand Down
Loading