@@ -397,12 +397,6 @@ impl SparkApplication {
397
397
mount_path: VOLUME_MOUNT_PATH_EXECUTOR_POD_TEMPLATES . into( ) ,
398
398
..VolumeMount :: default ( )
399
399
} ,
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
- } ,
406
400
] ;
407
401
408
402
tmpl_mounts = self . add_common_volume_mounts ( tmpl_mounts, s3conn, logdir, false ) ;
@@ -472,14 +466,16 @@ impl SparkApplication {
472
466
mount_path : VOLUME_MOUNT_PATH_LOG_CONFIG . into ( ) ,
473
467
..VolumeMount :: default ( )
474
468
} ) ;
475
-
476
- mounts. push ( VolumeMount {
477
- name : VOLUME_MOUNT_NAME_LOG . into ( ) ,
478
- mount_path : VOLUME_MOUNT_PATH_LOG . into ( ) ,
479
- ..VolumeMount :: default ( )
480
- } ) ;
481
469
}
482
470
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
+
483
479
if !self . packages ( ) . is_empty ( ) {
484
480
mounts. push ( VolumeMount {
485
481
name : VOLUME_MOUNT_NAME_IVY2 . into ( ) ,
@@ -693,13 +689,25 @@ impl SparkApplication {
693
689
) -> Vec < EnvVar > {
694
690
let mut e: Vec < EnvVar > = self . spec . env . clone ( ) ;
695
691
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
+ ] ) ;
703
711
704
712
if self . requirements ( ) . is_some ( ) {
705
713
e. push ( EnvVar {
0 commit comments