Skip to content

Commit b731bb8

Browse files
committed
ensure vol mount exists and remove env duplicates
1 parent edef3b6 commit b731bb8

File tree

2 files changed

+27
-44
lines changed

2 files changed

+27
-44
lines changed

rust/crd/src/lib.rs

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,6 @@ impl SparkApplication {
397397
mount_path: VOLUME_MOUNT_PATH_EXECUTOR_POD_TEMPLATES.into(),
398398
..VolumeMount::default()
399399
},
400-
// This is used at least by the containerdebug process
401-
VolumeMount {
402-
name: VOLUME_MOUNT_NAME_LOG.into(),
403-
mount_path: VOLUME_MOUNT_PATH_LOG.into(),
404-
..VolumeMount::default()
405-
},
406400
];
407401

408402
tmpl_mounts = self.add_common_volume_mounts(tmpl_mounts, s3conn, logdir, false);
@@ -472,14 +466,16 @@ impl SparkApplication {
472466
mount_path: VOLUME_MOUNT_PATH_LOG_CONFIG.into(),
473467
..VolumeMount::default()
474468
});
475-
476-
mounts.push(VolumeMount {
477-
name: VOLUME_MOUNT_NAME_LOG.into(),
478-
mount_path: VOLUME_MOUNT_PATH_LOG.into(),
479-
..VolumeMount::default()
480-
});
481469
}
482470

471+
// This is used at least by the containerdebug process.
472+
// The volume is always there.
473+
mounts.push(VolumeMount {
474+
name: VOLUME_MOUNT_NAME_LOG.into(),
475+
mount_path: VOLUME_MOUNT_PATH_LOG.into(),
476+
..VolumeMount::default()
477+
});
478+
483479
if !self.packages().is_empty() {
484480
mounts.push(VolumeMount {
485481
name: VOLUME_MOUNT_NAME_IVY2.into(),
@@ -693,13 +689,25 @@ impl SparkApplication {
693689
) -> Vec<EnvVar> {
694690
let mut e: Vec<EnvVar> = self.spec.env.clone();
695691

696-
// Needed by the `containerdebug` process running in the background of the `spark-submit`
697-
// container to log it's tracing information to.
698-
e.push(EnvVar {
699-
name: "CONTAINERDEBUG_LOG_DIRECTORY".to_string(),
700-
value: Some(format!("{VOLUME_MOUNT_PATH_LOG}/containerdebug")),
701-
value_from: None,
702-
});
692+
// These env variables enable the `containerdebug` process in driver and executor pods.
693+
// More precisely, this process runs in the background of every `spark` container.
694+
// - `CONTAINERDEBUG_LOG_DIRECTORY` - is the location where tracing information from the process
695+
// is written. This directory is created by the process it's self.
696+
// - `_STACKABLE_PRE_HOOK` - is evaluated by the entrypoint script (run-spark.sh) in the Spark images
697+
// before the actual JVM process is started. The result of this evaluation is that the
698+
// `containerdebug` process is executed in the background.
699+
e.extend(vec![
700+
EnvVar {
701+
name: "CONTAINERDEBUG_LOG_DIRECTORY".into(),
702+
value: Some(format!("{VOLUME_MOUNT_PATH_LOG}/containerdebug")),
703+
value_from: None,
704+
},
705+
EnvVar {
706+
name: "_STACKABLE_PRE_HOOK".into(),
707+
value: Some(format!( "containerdebug --output={VOLUME_MOUNT_PATH_LOG}/containerdebug-state.json --loop &")),
708+
value_from: None,
709+
},
710+
]);
703711

704712
if self.requirements().is_some() {
705713
e.push(EnvVar {

rust/operator-binary/src/spark_k8s_controller.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -612,31 +612,6 @@ fn pod_template(
612612
.resources(config.resources.clone().into())
613613
.image_from_product_image(spark_image);
614614

615-
// These env variables enable the `containerdebug` process in driver and executor pods.
616-
// More precisely, this process runs in the background of every `spark` container.
617-
// - `CONTAINERDEBUG_LOG_DIRECTORY` - is the location where tracing information from the process
618-
// is written. This directory is created by the process it's self.
619-
// - `_STACKABLE_PRE_HOOK` - is evaluated by the entrypoint script (run-spark.sh) in the Spark images
620-
// before the actual JVM process is started. The result of this evaluation is that the
621-
// `containerdebug` process is executed in the background.
622-
cb.add_env_vars(
623-
[
624-
EnvVar {
625-
name: "CONTAINERDEBUG_LOG_DIRECTORY".into(),
626-
value: Some(format!("{VOLUME_MOUNT_PATH_LOG}/containerdebug")),
627-
value_from: None,
628-
},
629-
EnvVar {
630-
name: "_STACKABLE_PRE_HOOK".into(),
631-
value: Some(format!(
632-
"containerdebug --output={VOLUME_MOUNT_PATH_LOG}/containerdebug-state.json --loop &"
633-
)),
634-
value_from: None,
635-
},
636-
]
637-
.into(),
638-
);
639-
640615
if config.logging.enable_vector_agent {
641616
cb.add_env_var(
642617
"_STACKABLE_POST_HOOK",

0 commit comments

Comments
 (0)