Skip to content

Commit

Permalink
feat: run containerdebug in the background (#554)
Browse files Browse the repository at this point in the history
* feat: run containerdebug in the background

* cargo update

* fix: remove unused env var

* cargo update

* reintroduce CONTAINERDEBUG_LOG_DIRECTORY

* factor out ctnrdebug test

* Sync Cargo.nix

---------

Co-authored-by: Natalie Klestrup Röijezon <[email protected]>
  • Loading branch information
razvan and nightkr authored Dec 17, 2024
1 parent 8f100f4 commit 72c21b3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]).
Expand All @@ -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

Expand Down
7 changes: 7 additions & 0 deletions rust/operator-binary/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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}
Expand Down
7 changes: 7 additions & 0 deletions tests/templates/kuttl/smoke/62-assert.yaml
Original file line number Diff line number Diff line change
@@ -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"'

0 comments on commit 72c21b3

Please sign in to comment.