Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
add ability for bug-report to get previous logs for control plane con…
Browse files Browse the repository at this point in the history
…tainers if they have been restarted

Signed-off-by: Thomas Stringer <[email protected]>
  • Loading branch information
trstringer committed Nov 17, 2021
1 parent 81b5265 commit 9926bc6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/bugreport/controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ func (c *Config) collectControlPlaneLogs() error {
return fmt.Errorf("error writing control pod logs: %w", err)
}
c.completionSuccess("Collected report for Pod %s/%s", pod.Namespace, pod.Name)

if pod.Status.ContainerStatuses[0].RestartCount > 0 {
cmd = append(cmd, "--previous")
outPath = path.Join(c.rootNamespaceDirPath(), pod.Namespace, rootPodDirName, pod.Name, commandsDirName, strings.Join(cmd, "_"))
if err := runCmdAndWriteToFile(cmd, outPath); err != nil {
return fmt.Errorf("error writing previous control pod logs: %w", err)
}
c.completionSuccess("Collected previous report for Pod %s/%s", pod.Namespace, pod.Name)
}
}

return nil
Expand Down

0 comments on commit 9926bc6

Please sign in to comment.