Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubetest2 - Dump all pod logs in addition to host logs #10799

Merged
merged 1 commit into from
Feb 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/e2e/kubetest2-kops/deployer/dumplogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ func (d *deployer) DumpClusterLogs() error {
return err
}

if err := d.dumpClusterInfo(); err != nil {
return err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A thought ... we may want to do these as best-effort (e.g. trying each dump step and returning a list of errors at the end)

}

return nil
}

Expand Down Expand Up @@ -75,6 +79,23 @@ func (d *deployer) dumpClusterManifest() error {
return nil
}

func (d *deployer) dumpClusterInfo() error {
args := []string{
"kubectl", "cluster-info", "dump",
"--all-namespaces",
"-o", "yaml",
"--output-directory", path.Join(d.ArtifactsDir, "cluster-info"),
}
klog.Info(strings.Join(args, " "))

cmd := exec.Command(args[0], args[1:]...)
cmd.SetEnv(d.env()...)
if err := cmd.Run(); err != nil {
return err
}
return nil
}

func runWithOutput(cmd exec.Cmd) error {
exec.InheritOutput(cmd)
return cmd.Run()
Expand Down