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

fix kind export logs #2161

Merged
merged 2 commits into from
Mar 26, 2021
Merged

Conversation

BenTheElder
Copy link
Member

  • export kind-version.txt at the top level, instead of per node. it's not a property of the node
  • always print the exported path so any logs that are exported can be debugged even if an error is encountered

@k8s-ci-robot k8s-ci-robot requested review from amwat and munnerz March 26, 2021 06:10
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 26, 2021
@BenTheElder
Copy link
Member Author

/kind bug

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 26, 2021
partial logs will still have been exported
logger.V(0).Infof("Exported logs for cluster %q to:", flags.Name)
// NOTE: the path is the output of this command to be captured by calling tools
// whereas "Exporting logs..." is info / debug (stderr)
logger.V(0).Infof("Exporting logs for cluster %q to:", flags.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

to: %s", dir) ??

Copy link
Member Author

Choose a reason for hiding this comment

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

no, we print the path to stdout for capture by the calling program.
we print the message to stderr.
(see the comment above)

Copy link
Member Author

Choose a reason for hiding this comment

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

e.g.:

$ kind export logs
Exporting logs for cluster "kind" to: 
/private/var/folders/rt/xdpktcmj0p7fx3kvwmrgdqyh00fsfv/T/609940926
ERROR: [command "docker exec --privileged kind-control-plane sh -c 'tar --hard-dereference -C /var/log/ -chf - . || (r=$?; [ $r -eq 1 ] || exit $r)'" failed with error: exit status 1, [command "docker exec --privileged kind-control-plane cat /kind/version" failed with error: exit status 1, command "docker exec --privileged kind-control-plane journalctl --no-pager -u kubelet.service" failed with error: exit status 1, command "docker exec --privileged kind-control-plane journalctl --no-pager -u containerd.service" failed with error: exit status 1, command "docker exec --privileged kind-control-plane journalctl --no-pager" failed with error: exit status 1]]

the stdout part is /private/var/folders/rt/xdpktcmj0p7fx3kvwmrgdqyh00fsfv/T/609940926

Copy link
Member Author

Choose a reason for hiding this comment

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

note: in this commit I basically just moved this up before we actually export (so if we hit an error you can still see where the logs we did collect are) and s/Exported/Exporting/

@aojea
Copy link
Contributor

aojea commented Mar 26, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 26, 2021
@k8s-ci-robot k8s-ci-robot merged commit d0df6d2 into kubernetes-sigs:main Mar 26, 2021
@BenTheElder BenTheElder deleted the export-version branch March 26, 2021 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants