diff --git a/CHANGELOG.md b/CHANGELOG.md index da8a8092..100ff7e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added + +- Run a `containerdebug` process in the background of each Hive container to collect debugging information ([#554]). + ### Changed - Bump `stackable-operator` from `0.82.0` to `0.83.0` ([#553]). @@ -16,6 +20,7 @@ All notable changes to this project will be documented in this file. [#544]: https://github.com/stackabletech/hive-operator/pull/544 [#553]: https://github.com/stackabletech/hive-operator/pull/553 +[#554]: https://github.com/stackabletech/hive-operator/pull/554 ## [24.11.0] - 2024-11-18 diff --git a/rust/operator-binary/src/controller.rs b/rust/operator-binary/src/controller.rs index e609b81f..ba3d643d 100644 --- a/rust/operator-binary/src/controller.rs +++ b/rust/operator-binary/src/controller.rs @@ -850,6 +850,12 @@ fn build_metastore_rolegroup_statefulset( container_builder.add_env_vars(vec![ env_var_from_secret(DB_USERNAME_ENV, &credentials_secret_name, "username"), env_var_from_secret(DB_PASSWORD_ENV, &credentials_secret_name, "password"), + // Needed for the `containerdebug` process to log it's tracing information to. + EnvVar { + name: "CONTAINERDEBUG_LOG_DIRECTORY".to_string(), + value: Some(format!("{STACKABLE_LOG_DIR}/containerdebug")), + value_from: None, + }, ]); let mut pod_builder = PodBuilder::new(); @@ -913,6 +919,7 @@ fn build_metastore_rolegroup_statefulset( {COMMON_BASH_TRAP_FUNCTIONS} {remove_vector_shutdown_file_command} prepare_signal_handlers + containerdebug --output={STACKABLE_LOG_DIR}/containerdebug-state.json --loop & {start_command} wait_for_termination $! {create_vector_shutdown_file_command} diff --git a/tests/templates/kuttl/smoke/62-assert.yaml b/tests/templates/kuttl/smoke/62-assert.yaml new file mode 100644 index 00000000..f729d72f --- /dev/null +++ b/tests/templates/kuttl/smoke/62-assert.yaml @@ -0,0 +1,7 @@ +--- +# This test checks if the containerdebug-state.json file is present and valid +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +commands: + - script: kubectl exec -n $NAMESPACE --container hive hive-metastore-default-0 -- cat /stackable/log/containerdebug-state.json | jq --exit-status '"valid JSON"'