Skip to content

Commit 87655f9

Browse files
committed
implement pod overrides
1 parent eed00d1 commit 87655f9

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

rust/operator-binary/src/connect/controller.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use stackable_operator::{
2727
},
2828
},
2929
apimachinery::pkg::apis::meta::v1::LabelSelector,
30+
DeepMerge,
3031
},
3132
kube::{
3233
core::{error_boundary, DeserializeGuard},
@@ -525,7 +526,11 @@ fn build_deployment(
525526
);
526527
}
527528

528-
let pod_template = pb.build_template();
529+
// Merge user defined pod template if available
530+
let mut pod_template = pb.build_template();
531+
if let Some(pod_overrides_spec) = scs.spec.server.as_ref().map(|s| s.pod_overrides.clone()) {
532+
pod_template.merge_from(pod_overrides_spec);
533+
}
529534

530535
Ok(Deployment {
531536
metadata: ObjectMetaBuilder::new()
@@ -768,6 +773,8 @@ fn jvm_security_properties(
768773
to_java_properties_string(result.iter()).context(JvmSecurityPropertiesSnafu)
769774
}
770775

776+
// Returns the contents of the spark properties file.
777+
// It merges operator properties with user properties.
771778
#[allow(clippy::result_large_err)]
772779
fn spark_properties(
773780
driver_service: &Service,
@@ -789,7 +796,11 @@ fn spark_properties(
789796
Some(driver_service.name_any()),
790797
),
791798
(
792-
"spark.kubernetes.container.image".to_string(),
799+
"spark.kubernetes.driver.container.image".to_string(),
800+
Some(spark_image.clone()),
801+
),
802+
(
803+
"spark.kubernetes.executor.container.image".to_string(),
793804
Some(spark_image),
794805
),
795806
("spark.kubernetes.namespace".to_string(), Some(namespace)),

tests/templates/kuttl/spark-connect/10-deploy-spark-connect.yaml.j2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ spec:
3636
vectorAggregatorConfigMapName: vector-aggregator-discovery
3737
{% endif %}
3838
server:
39+
podOverrides:
40+
spec:
41+
containers:
42+
- name: spark-connect
43+
env:
44+
- name: DEMO_GREETING
45+
value: "Hello from the overlords"
3946
jvmArgumentOverrides:
4047
add:
4148
- -Xmx800m

0 commit comments

Comments
 (0)