-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 kubectl desc nodes to minikube logs #7105
Merged
tstromberg
merged 8 commits into
kubernetes:master
from
prasadkatti:add_desc_node_to_minikube_logs
Mar 21, 2020
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
68f973c
Add describe nodes to minikube logs
prasadkatti 8d48c68
minor update based on review feedback
prasadkatti 4faa31e
Add logic to get desc node output in bootstrapper LogCommands func
prasadkatti df80a60
Merge branch 'master' into add_desc_node_to_minikube_logs
prasadkatti c3f1f5e
some more plumbing work to pass cfg in kverify.go
prasadkatti a880bb7
Merge branch 'master' into add_desc_node_to_minikube_logs
prasadkatti ba6dbc5
Update the call to logProblems in node/start.go
prasadkatti 376271a
Merge branch 'master' into add_desc_node_to_minikube_logs
prasadkatti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,16 +23,20 @@ import ( | |
"fmt" | ||
"os" | ||
"os/exec" | ||
"path" | ||
"regexp" | ||
"sort" | ||
"strings" | ||
|
||
"github.com/golang/glog" | ||
"github.com/pkg/errors" | ||
"github.com/spf13/viper" | ||
"k8s.io/minikube/pkg/minikube/bootstrapper" | ||
"k8s.io/minikube/pkg/minikube/command" | ||
"k8s.io/minikube/pkg/minikube/config" | ||
"k8s.io/minikube/pkg/minikube/cruntime" | ||
"k8s.io/minikube/pkg/minikube/out" | ||
"k8s.io/minikube/pkg/minikube/vmpath" | ||
) | ||
|
||
// rootCauseRe is a regular expression that matches known failure root causes | ||
|
@@ -186,5 +190,15 @@ func logCommands(r cruntime.Manager, bs bootstrapper.Bootstrapper, length int, f | |
} | ||
cmds[r.Name()] = r.SystemLogCmd(length) | ||
cmds["container status"] = cruntime.ContainerStatusCommand() | ||
|
||
cfg, err := config.Load(viper.GetString(config.ProfileName)) | ||
if err != nil && !config.IsNotExist(err) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can just say
here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay, thanks for the review! Are the failing checks unrelated to my changes? I couldn't really tell. |
||
out.ErrLn("Error loading profile config: %v", err) | ||
} | ||
|
||
cmds["describe nodes"] = fmt.Sprintf("sudo %s describe node -A --kubeconfig=%s", | ||
path.Join(vmpath.GuestPersistentDir, "binaries", cfg.KubernetesConfig.KubernetesVersion, "kubectl"), | ||
path.Join(vmpath.GuestPersistentDir, "kubeconfig")) | ||
|
||
return cmds | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nicely done! Thank you!
So, the frustrating part is that the configuration for this profile is already loaded, but the logs package does not have access to it. If it isn't too much trouble on your part, can you help us get that addressed? It'll be cleaner and faster that way.
I know I said differently in the issue, but lets start by moving this addition to the
kubeadm
bootstrapper, since it's the only one that guarantees where the kubelet is installed. Start my moving your code here:minikube/pkg/minikube/bootstrapper/kubeadm/kubeadm.go
Line 113 in 729642e
Now, to plumb in our missing loaded configuration (
config.ClusterConfig
). First pass thecfg
variable tologs.Output
:minikube/cmd/minikube/cmd/logs.go
Line 109 in 729642e
Then
logs.logCommands
, where we are now:minikube/pkg/minikube/logs/logs.go
Line 158 in 729642e
Then to
bs.LogCommands
(effectivelykubeadm.LogCommands
), which handles bootstrapper specific logs:minikube/pkg/minikube/logs/logs.go
Line 196 in 729642e
One tip: Some packages name the
config.ClusterConfig
variable ascfg
, some name itcc
. Use whichever nomenclature you find in the package, which I believe will usually becfg
in this part of the code base.If this is all too much, please let me know. Thank you again! The code looks great otherwise.
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.
I can definitely try. If I need help along the way, I will ask on the slack channel.