[deckhouse-cli] Updating the debug archive and adding an archive for virtualization - #472
[deckhouse-cli] Updating the debug archive and adding an archive for virtualization#472VaLosev wants to merge 9 commits into
Conversation
Signed-off-by: Valery Losev <valery.losev@flant.com>
Signed-off-by: Valery Losev <valery.losev@flant.com>
Signed-off-by: Valery Losev <valery.losev@flant.com>
Signed-off-by: Valery Losev <valery.losev@flant.com>
There was a problem hiding this comment.
🟡 Changes recommended
There are user-facing behavioral issues (notably --exclude no longer matching module-expanded filenames as documented) and reliability issues from ignoring tar/gzip Close() errors that can produce silently corrupted archives.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR enhances d8 system collect-debug-info by reorganizing debug archive contents (renamed output files, additional collected resources) and extracting a reusable command-execution pipeline, while also introducing a dedicated virtualization subcommand to collect a separate, more detailed archive for the d8-virtualization namespace.
Changes:
- Refactored the tarball creation flow by extracting the exec→tar loop into a reusable
runCommandshelper. - Renamed/added collected artifacts in the main debug archive (including CRD collection and additional virtualization module controller logs with tail limits).
- Added
d8 system collect-debug-info virtualizationto collect per-pod logs fromd8-virtualizationwith an option to skip DaemonSet-owned pod logs.
File summaries
| File | Description |
|---|---|
| internal/system/cmd/collect-debug-info/virtualizationtar/virtualizationTar.go | Adds the new virtualization cobra subcommand and CLI flags. |
| internal/system/cmd/collect-debug-info/debugtar/virtualizationTarball.go | Implements the virtualization-focused tarball (pod discovery + per-pod logs). |
| internal/system/cmd/collect-debug-info/debugtar/debugTar.go | Renames/extends the main debug command list and extracts runCommands. |
| internal/system/cmd/collect-debug-info/collect-debug-info.go | Wires the new virtualization subcommand into collect-debug-info. |
Review details
Suppressed comments (1)
internal/system/cmd/collect-debug-info/debugtar/debugTar.go:177
- Same issue as the CCM logs filename:
{module-name}prefix breaks prefix-based--excludevalues likecsi-controller-logsand makes--list-excludeoutput less useful. Keeping the placeholder at the end preserves existing exclusion behavior.
File: "{module-name}-csi-controller-logs.txt",
- Files reviewed: 4/4 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Glitchy-Sheep
left a comment
There was a problem hiding this comment.
Two things to fix before merging, both in the base archive:
--excludeand--list-excludebreak for per-module files after the rename. See the inline comment.- MCM machines are dropped from the archive instead of being collected alongside CAPI machines. See the inline comment.
One thing to decide: renaming almost every file in the archive is a breaking change. It affects existing --exclude values, support scripts and the docs on the site. The card and the thread did not ask for it. If we keep it, please state it in the PR description and update the --exclude example in the help once the exclude logic is fixed.
Optional: --all-containers=true in the log commands would also capture sidecars, for example the second container of dvcr. kubectl defaults to the first container, so this is not blocking.
Signed-off-by: Valery Losev <valery.losev@flant.com>
Signed-off-by: Valery Losev <valery.losev@flant.com>
Signed-off-by: Valery Losev <valery.losev@flant.com>
Signed-off-by: Valery Losev <valery.losev@flant.com>
Signed-off-by: Valery Losev <valery.losev@flant.com>
In the current archive, which is collected with the command:
d8 system collect-debug-infoCRDcollection from the clustermachineresources for CAPI. MCMmachinehas been moved to a separate file - instance-manager-mcm-cloud-machines.jsonexec→tarcycle has been moved from Tarball() to a reusable runCommands so that it can be used in the new virtualization archive.The
ExpandPerModule boolfield has been removed fromCommand; the decision to execute the command for all modules found inRequiredModuleis now based on the presence of{module-name}in theFileorArgsfields. This ensures there is a single source of truth for this mechanism: the template itself.A test has also been added to ensure that
{module-name}is not used withoutRequiredModule.Also added a separate command for collecting logs from all pods from ns - d8-virtualization:
d8 system collect-debug-info virtualizationThis was done because 3000-line logs are often insufficient for virtualization diagnostics, and logs from
virt-handlerpods, which are launched via DS on each node, are also very important - there can be many of them. (by number of nodes)Collecting all these logs into the main archive could significantly increase its size, and the debug archive should remain a quick diagnostic tool so clients can quickly collect and send it.
So, in the event of virtualization issues, if the standard archive's logs are insufficient, a special virtualization archive can be requested.
The
--command-timeoutand--request-intervalflags have been copied to this new archive, and a new--skip-ds-logsflag has been added to disable log collection from DS modules in the case of a large number of nodes.