Skip to content

Commit 5212eae

Browse files
committed
refactor: remove pod_driver_controller.rs
1 parent 283dda8 commit 5212eae

6 files changed

Lines changed: 216 additions & 195 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
1818

1919
- BREAKING: The operator no longer runs a separate `spark-submit` process for `SparkApplication`s. The driver is launched directly as a Kubernetes `Job` (built from `spec.driver`) running `spark-submit` in client mode; executors are still created by the driver via Spark's Kubernetes backend. A headless driver `Service` is created so executors can reach the driver. This affects both `v1alpha1` (after conversion) and `v1alpha2` objects ([#711]).
2020
- The driver `Job` is no longer retried on failure (`backoffLimit` is `0`); the previous `spec.job.retryOnFailureCount` is deprecated and ignored ([#711]).
21+
- The `SparkApplication` status (`status.phase`) is now derived from the driver `Job` status by the application controller instead of a dedicated pod-driver controller watching driver pods. The pod-driver controller and the operator's `pods` RBAC permissions have been removed ([#711]).
2122
- Document Helm deployed RBAC permissions and remove unnecessary permissions ([#674]).
2223
- BREAKING: Each custom resource accepts now only the known config files in `configOverrides`:
2324
- `SparkApplication`: `spark-env.sh` and `security.properties`

deploy/helm/spark-k8s-operator/templates/roles.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ rules:
1313
- nodes/proxy
1414
verbs:
1515
- get
16-
# The pod-driver controller watches Spark driver pods (labelled spark-role=driver) to track
17-
# SparkApplication completion. Driver pods are owned by the driver Job and cleaned up via the
18-
# Job's ttlSecondsAfterFinished, so the operator no longer deletes them.
19-
- apiGroups:
20-
- ""
21-
resources:
22-
- pods
23-
verbs:
24-
- get
25-
- list
26-
- watch
2716
# ConfigMaps hold pod templates and Spark configuration. All three controllers apply
2817
# them via Server-Side Apply (create + patch). The history and connect controllers
2918
# track them for orphan cleanup (list + delete). All controllers watch ConfigMaps via

rust/operator-binary/src/crd/constants.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ pub const FIELD_MANAGER: &str = "spark-operator";
6666
pub const SPARK_CONTROLLER_NAME: &str = "sparkapplication";
6767
pub const SPARK_FULL_CONTROLLER_NAME: &str = concatcp!(SPARK_CONTROLLER_NAME, '.', OPERATOR_NAME);
6868

69-
pub const POD_DRIVER_CONTROLLER_NAME: &str = "pod-driver";
70-
pub const POD_DRIVER_FULL_CONTROLLER_NAME: &str =
71-
concatcp!(POD_DRIVER_CONTROLLER_NAME, '.', OPERATOR_NAME);
72-
7369
pub const HISTORY_CONTROLLER_NAME: &str = "history";
7470
pub const HISTORY_FULL_CONTROLLER_NAME: &str =
7571
concatcp!(HISTORY_CONTROLLER_NAME, '.', OPERATOR_NAME);

rust/operator-binary/src/main.rs

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use stackable_operator::{
1616
k8s_openapi::api::{
1717
apps::v1::StatefulSet,
1818
batch::v1::Job,
19-
core::v1::{ConfigMap, Pod, Service},
19+
core::v1::{ConfigMap, Service},
2020
},
2121
kube::{
2222
CustomResourceExt as _,
@@ -40,8 +40,7 @@ use crate::{
4040
crd::{
4141
SparkApplication,
4242
constants::{
43-
HISTORY_FULL_CONTROLLER_NAME, OPERATOR_NAME, POD_DRIVER_FULL_CONTROLLER_NAME,
44-
SPARK_CONTROLLER_NAME, SPARK_FULL_CONTROLLER_NAME,
43+
HISTORY_FULL_CONTROLLER_NAME, OPERATOR_NAME, SPARK_FULL_CONTROLLER_NAME,
4544
},
4645
history::SparkHistoryServer,
4746
template_spec::{SparkApplicationTemplate, SparkApplicationTemplateVersion},
@@ -53,7 +52,6 @@ mod config;
5352
mod connect;
5453
mod crd;
5554
mod history;
56-
mod pod_driver_controller;
5755
mod product_logging;
5856
mod spark_k8s_controller;
5957
mod webhooks;
@@ -199,47 +197,6 @@ async fn main() -> anyhow::Result<()> {
199197
)
200198
.map(anyhow::Ok);
201199

202-
let pod_driver_event_recorder = Arc::new(Recorder::new(
203-
client.as_kube_client(),
204-
Reporter {
205-
controller: POD_DRIVER_FULL_CONTROLLER_NAME.to_string(),
206-
instance: None,
207-
},
208-
));
209-
let pod_driver_controller = Controller::new(
210-
watch_namespace.get_api::<DeserializeGuard<Pod>>(&client),
211-
watcher::Config::default()
212-
.labels(&format!("app.kubernetes.io/managed-by={OPERATOR_NAME}_{SPARK_CONTROLLER_NAME},spark-role=driver")),
213-
)
214-
.owns(
215-
watch_namespace.get_api::<DeserializeGuard<Pod>>(&client),
216-
watcher::Config::default(),
217-
)
218-
.graceful_shutdown_on(sigterm_watcher.handle())
219-
.run(
220-
pod_driver_controller::reconcile,
221-
pod_driver_controller::error_policy,
222-
Arc::new(client.clone()),
223-
)
224-
.instrument(info_span!("pod_driver_controller"))
225-
// We can let the reporting happen in the background
226-
.for_each_concurrent(
227-
16, // concurrency limit
228-
|result| {
229-
// The event_recorder needs to be shared across all invocations, so that
230-
// events are correctly aggregated
231-
let pod_driver_event_recorder = pod_driver_event_recorder.clone();
232-
async move {
233-
report_controller_reconciled(
234-
&pod_driver_event_recorder,
235-
POD_DRIVER_FULL_CONTROLLER_NAME,
236-
&result,
237-
)
238-
.await;
239-
}
240-
},
241-
).map(anyhow::Ok);
242-
243200
// Create new object because Ctx cannot be cloned
244201
let ctx = Ctx {
245202
client: client.clone(),
@@ -399,7 +356,6 @@ async fn main() -> anyhow::Result<()> {
399356

400357
// kube-runtime's Controller will tokio::spawn each reconciliation, so this only concerns the internal watch machinery
401358
futures::try_join!(
402-
pod_driver_controller,
403359
delayed_history_controller,
404360
delayed_connect_controller,
405361
delayed_app_controller,

rust/operator-binary/src/pod_driver_controller.rs

Lines changed: 0 additions & 132 deletions
This file was deleted.

0 commit comments

Comments
 (0)