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

Add libmachine debug logs back #5574

Merged
merged 4 commits into from
Oct 9, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions cmd/minikube/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/notify"
"k8s.io/minikube/pkg/minikube/translate"
)

Expand Down Expand Up @@ -76,6 +77,7 @@ var RootCmd = &cobra.Command{
exit.WithError("logdir set failed", err)
}
}
notify.MaybePrintUpdateTextFromGithub()
sharifelgamal marked this conversation as resolved.
Show resolved Hide resolved
},
}

Expand Down
34 changes: 14 additions & 20 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,13 @@ const (
)

var (
registryMirror []string
dockerEnv []string
dockerOpt []string
insecureRegistry []string
apiServerNames []string
apiServerIPs []net.IP
extraOptions cfg.ExtraOptionSlice
enableUpdateNotification = true
registryMirror []string
dockerEnv []string
dockerOpt []string
insecureRegistry []string
apiServerNames []string
apiServerIPs []net.IP
extraOptions cfg.ExtraOptionSlice
)

func init() {
Expand Down Expand Up @@ -291,7 +290,13 @@ func runStart(cmd *cobra.Command, args []string) {
validateFlags(driver)
validateUser(driver)

_ = getMinikubeVersion(driver)
v, err := version.GetSemverVersion()
if err != nil {
out.WarningT("Error parsing minikube version: {{.error}}", out.V{"error": err})
} else if err := drivers.InstallOrUpdate(driver, localpath.MakeMiniPath("bin"), v, viper.GetBool(interactive)); err != nil {
out.WarningT("Unable to update {{.driver}} driver: {{.error}}", out.V{"driver": driver, "error": err})
}

k8sVersion, isUpgrade := getKubernetesVersion(oldConfig)
config, err := generateCfgFromFlags(cmd, k8sVersion, driver)
if err != nil {
Expand Down Expand Up @@ -922,17 +927,6 @@ func validateNetwork(h *host.Host) string {
return ip
}

// getMinikubeVersion ensures that the driver binary is up to date
func getMinikubeVersion(driver string) string {
v, err := version.GetSemverVersion()
if err != nil {
out.WarningT("Error parsing minikube version: {{.error}}", out.V{"error": err})
} else if err := drivers.InstallOrUpdate(driver, localpath.MakeMiniPath("bin"), v, viper.GetBool(interactive)); err != nil {
out.WarningT("Unable to update {{.driver}} driver: {{.error}}", out.V{"driver": driver, "error": err})
}
return v.String()
}

// getKubernetesVersion ensures that the requested version is reasonable
func getKubernetesVersion(old *cfg.Config) (string, bool) {
rawVersion := viper.GetString(kubernetesVersion)
Expand Down
4 changes: 0 additions & 4 deletions cmd/minikube/cmd/update-check.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ var updateCheckCmd = &cobra.Command{
Use: "update-check",
Short: "Print current and latest version number",
Long: `Print current and latest version number`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Explicitly disable update checking for the version command
enableUpdateNotification = false
},
Run: func(command *cobra.Command, args []string) {
url := notify.GithubMinikubeReleasesURL
r, err := notify.GetAllVersionsFromURL(url)
Expand Down
4 changes: 0 additions & 4 deletions cmd/minikube/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version of minikube",
Long: `Print the version of minikube.`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Explicitly disable update checking for the version command
enableUpdateNotification = false
},
Run: func(command *cobra.Command, args []string) {
out.Ln("minikube version: %v", version.GetVersion())
gitCommitID := version.GetGitCommitID()
Expand Down
5 changes: 4 additions & 1 deletion cmd/minikube/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ import (
const minikubeEnableProfile = "MINIKUBE_ENABLE_PROFILING"

var (
machineLogErrorRe = regexp.MustCompile(`(?i) (failed|error|fatal)`)
// This regex is intentionally very specific, it's supposed to surface
// unexpected errors from libmachine to the user.
machineLogErrorRe = regexp.MustCompile(`VirtualizationException`)
machineLogWarningRe = regexp.MustCompile(`(?i)warning`)
)

Expand All @@ -67,6 +69,7 @@ func bridgeLogMessages() {
log.SetOutput(stdLogBridge{})
mlog.SetErrWriter(machineLogBridge{})
mlog.SetOutWriter(machineLogBridge{})
mlog.SetDebug(true)
}

type stdLogBridge struct{}
Expand Down