-
Notifications
You must be signed in to change notification settings - Fork 7
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
[d8] Add d8 collect-debug-info #81
base: main
Are you sure you want to change the base?
Conversation
4200c8f
to
a29a9ac
Compare
ca010b1
to
581ed5d
Compare
bfca89d
to
07b5b93
Compare
internal/platform/cmd/collect-debug-info/createtarball/createtarball.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor things
internal/platform/cmd/collect-debug-info/createtarball/createtarball.go
Outdated
Show resolved
Hide resolved
internal/platform/cmd/collect-debug-info/createtarball/createtarball.go
Outdated
Show resolved
Hide resolved
internal/platform/cmd/collect-debug-info/createtarball/createtarball.go
Outdated
Show resolved
Hide resolved
7be2faa
to
7e546d9
Compare
if term.IsTerminal(int(os.Stdout.Fd())) { | ||
return fmt.Errorf("Please provide output tar.gz to dump debug logs, ex. \"> dump-logs.tar.gz\"") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be done early, there is no point in reaching to the kube-apiserver if we know that we are not going to output to file and throw error anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PreRunE
seems like a good place to put such checks
https://pkg.go.dev/github.com/spf13/cobra#Command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, moved it to PreRunE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that you forgot to remove it here
var err error | ||
if term.IsTerminal(int(os.Stdout.Fd())) { | ||
return fmt.Errorf("Please provide output tar.gz to dump debug logs, ex. \"> dump-logs.tar.gz\"") | ||
} | ||
return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var err error
is not required, return nil explicitly. Doing it in this way may cause nasty bugs that are hard to debug.
This pr add d8 platform collect-debug-info option to save output debug info to tar.gz archive.
e.g.