-
Notifications
You must be signed in to change notification settings - Fork 15
Add logs for kubeadm #125
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
Add logs for kubeadm #125
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -267,8 +267,8 @@ func (n *nodeJoinAction) runJoin( | |||||||||||||
| return status.Errorf(codes.Internal, "resolve kubeadm binary: %s", err) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if err := utilexec.New().CommandContext(ctx, kubeadmCommand, "join", "--config", joinConfig, "-v", "5").Run(); err != nil { | ||||||||||||||
| return status.Errorf(codes.Internal, "kubeadm join: %s", err) | ||||||||||||||
| if output, err := utilexec.New().CommandContext(ctx, kubeadmCommand, "join", "--config", joinConfig, "-v", "5").CombinedOutput(); err != nil { | ||||||||||||||
| return status.Errorf(codes.Internal, "kubeadm join: %s\n%s", err, string(output)) | ||||||||||||||
|
||||||||||||||
| return status.Errorf(codes.Internal, "kubeadm join: %s\n%s", err, string(output)) | |
| trimmedOutput := strings.TrimSpace(string(output)) | |
| if trimmedOutput != "" { | |
| return status.Errorf(codes.Internal, "kubeadm join: %s\n%s", err, trimmedOutput) | |
| } | |
| return status.Errorf(codes.Internal, "kubeadm join: %s", err) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,10 +75,10 @@ func (n *nodeResetAction) runReset(ctx context.Context) error { | |
| // --force skips the interactive confirmation prompt and proceeds even | ||
| // when the node is unreachable by the control plane. | ||
| // -v 5 provides verbose output for debugging. | ||
| if err := utilexec.New().CommandContext( | ||
| if output, err := utilexec.New().CommandContext( | ||
| ctx, kubeadmBinary, "reset", "--force", "-v", "5", | ||
| ).Run(); err != nil { | ||
| return status.Errorf(codes.Internal, "kubeadm reset: %s", err) | ||
| ).CombinedOutput(); err != nil { | ||
| return status.Errorf(codes.Internal, "kubeadm reset: %s\n%s", err, string(output)) | ||
|
Comment on lines
+78
to
+81
|
||
| } | ||
|
|
||
| return nil | ||
|
|
||
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.
CombinedOutput()buffers all kubeadm stdout/stderr in memory and then embeds it verbatim into the gRPC status message. This makes the returned error unbounded in size (potentially causing high memory usage and/or exceeding gRPC message/log size limits). Consider truncating the captured output (e.g., last N KB/lines) and/or logging full output separately, and only including a bounded summary in the returned error message.