diff --git a/rust/crd/src/lib.rs b/rust/crd/src/lib.rs index 57e9bb81..3f85f2d8 100644 --- a/rust/crd/src/lib.rs +++ b/rust/crd/src/lib.rs @@ -326,18 +326,18 @@ impl SparkApplication { .with_config_map(log_config_map) .build(), ); - - result.push( - VolumeBuilder::new(VOLUME_MOUNT_NAME_LOG) - .with_empty_dir( - None::, - Some(product_logging::framework::calculate_log_volume_size_limit( - &[MAX_SPARK_LOG_FILES_SIZE, MAX_INIT_LOG_FILES_SIZE], - )), - ) - .build(), - ); } + // This volume is also used by the containerdebug process so it must always be there. + result.push( + VolumeBuilder::new(VOLUME_MOUNT_NAME_LOG) + .with_empty_dir( + None::, + Some(product_logging::framework::calculate_log_volume_size_limit( + &[MAX_SPARK_LOG_FILES_SIZE, MAX_INIT_LOG_FILES_SIZE], + )), + ) + .build(), + ); if !self.packages().is_empty() { result.push( @@ -397,6 +397,12 @@ impl SparkApplication { mount_path: VOLUME_MOUNT_PATH_EXECUTOR_POD_TEMPLATES.into(), ..VolumeMount::default() }, + // This is used at least by the containerdebug process + VolumeMount { + name: VOLUME_MOUNT_NAME_LOG.into(), + mount_path: VOLUME_MOUNT_PATH_LOG.into(), + ..VolumeMount::default() + }, ]; tmpl_mounts = self.add_common_volume_mounts(tmpl_mounts, s3conn, logdir, false); @@ -675,7 +681,7 @@ impl SparkApplication { submit_cmd.extend(self.spec.args.clone()); Ok(vec![ - format!("containerdebug --output={VOLUME_MOUNT_PATH_LOG}/containerdebug/containerdebug-state.json --loop &"), + format!("containerdebug --output={VOLUME_MOUNT_PATH_LOG}/containerdebug-state.json --loop &"), submit_cmd.join(" "), ]) } @@ -1386,6 +1392,12 @@ mod tests { name: "executor-pod-template".into(), ..VolumeMount::default() }, + VolumeMount { + mount_path: "/stackable/log".into(), + mount_propagation: None, + name: "log".into(), + ..VolumeMount::default() + }, VolumeMount { mount_path: "/kerberos".into(), mount_propagation: None, diff --git a/rust/operator-binary/src/history/history_controller.rs b/rust/operator-binary/src/history/history_controller.rs index 279ecab4..90f79be0 100644 --- a/rust/operator-binary/src/history/history_controller.rs +++ b/rust/operator-binary/src/history/history_controller.rs @@ -757,7 +757,7 @@ fn command_args(logdir: &ResolvedLogDir) -> Vec { } command.extend(vec![ - format!("containerdebug --output={VOLUME_MOUNT_PATH_LOG}/containerdebug/containerdebug-state.json --loop &"), + format!("containerdebug --output={VOLUME_MOUNT_PATH_LOG}/containerdebug-state.json --loop &"), format!("/stackable/spark/sbin/start-history-server.sh --properties-file {VOLUME_MOUNT_PATH_CONFIG}/{SPARK_DEFAULTS_FILE_NAME}"), ]); vec![command.join("\n")] diff --git a/rust/operator-binary/src/spark_k8s_controller.rs b/rust/operator-binary/src/spark_k8s_controller.rs index 8f7f2b53..d08f0142 100644 --- a/rust/operator-binary/src/spark_k8s_controller.rs +++ b/rust/operator-binary/src/spark_k8s_controller.rs @@ -614,7 +614,9 @@ fn pod_template( cb.add_env_var( "_STACKABLE_PRE_HOOK", - format!("containerdebug --output={VOLUME_MOUNT_PATH_LOG}/containerdebug/containerdebug-state.json --loop &"), + format!( + "containerdebug --output={VOLUME_MOUNT_PATH_LOG}/containerdebug-state.json --loop &" + ), ); if config.logging.enable_vector_agent { diff --git a/tests/templates/kuttl/smoke/40-assert.yaml b/tests/templates/kuttl/smoke/40-assert.yaml index 2d4822d4..ecd25de4 100644 --- a/tests/templates/kuttl/smoke/40-assert.yaml +++ b/tests/templates/kuttl/smoke/40-assert.yaml @@ -15,4 +15,4 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert timeout: 60 commands: - - script: kubectl exec -n $NAMESPACE --container spark-history spark-history-node-default-0 -- cat /stackable/log/containerdebug/containerdebug-state.json | jq --exit-status + - script: kubectl exec -n $NAMESPACE --container spark-history spark-history-node-default-0 -- cat /stackable/log/containerdebug-state.json | jq --exit-status diff --git a/tests/templates/kuttl/smoke/50-assert.yaml b/tests/templates/kuttl/smoke/50-assert.yaml index 48355622..a5aa81e2 100644 --- a/tests/templates/kuttl/smoke/50-assert.yaml +++ b/tests/templates/kuttl/smoke/50-assert.yaml @@ -12,4 +12,4 @@ kind: TestAssert commands: - script: | SPARK_SUBMIT_POD=$(kubectl get -n $NAMESPACE pods --field-selector=status.phase=Running --selector batch.kubernetes.io/job-name=spark-pi-s3-1 -o jsonpath='{.items[0].metadata.name}') - kubectl exec -n $NAMESPACE --container spark-submit $SPARK_SUBMIT_POD -- cat /stackable/log/containerdebug/containerdebug-state.json | jq --exit-status + kubectl exec -n $NAMESPACE --container spark-submit $SPARK_SUBMIT_POD -- cat /stackable/log/containerdebug-state.json | jq --exit-status