fix: include K6 helper pod logs in ChaosCenter backend with proper error handling #5323
+27
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #5208
🧩 What happened
When running K6 load tests using LitmusChaos, users observed the following message in ChaosCenter logs:
Even though the actual K6 test results existed, they were hidden because the backend only fetched logs from the main or runner pods.
However, in K6 experiments, the real results are stored in the helper pod (
*-helper).⚙️ Root Cause
K6 experiments follow a 4-level Kubernetes pod hierarchy:
experiment-name-timestamp-xxxxxexperiment-runner-xxxxxexperiment-job-xxxxxexperiment-helper-xxxxx← contains actual K6 load test logsThe backend code at
chaoscenter/subscriber/pkg/k8s/log.godid not include fallback logic to check for the helper pod, leading to empty or failed log retrieval.
🧠 What this PR does
✅ Adds fallback logic to retrieve logs from the helper container when main logs are unavailable.
✅ Improves error handling to clearly report missing log sources.
✅ Ensures K6 experiment logs are now visible in ChaosCenter.
✅ Keeps existing functionality intact for other experiment types.
Updated backend logic snippet: