Add host distro to minikube start & guest distro to logs
parent
f872767afe
commit
4b9402fc82
|
@ -41,6 +41,7 @@ import (
|
|||
"github.com/google/go-containerregistry/pkg/authn"
|
||||
"github.com/google/go-containerregistry/pkg/name"
|
||||
"github.com/google/go-containerregistry/pkg/v1/remote"
|
||||
gopshost "github.com/shirou/gopsutil/host"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
@ -206,9 +207,41 @@ var startCmd = &cobra.Command{
|
|||
Run: runStart,
|
||||
}
|
||||
|
||||
// platform generates a user-readable platform message
|
||||
func platform() string {
|
||||
var s strings.Builder
|
||||
|
||||
// Show the distro version if possible
|
||||
hi, err := gopshost.Info()
|
||||
if err == nil {
|
||||
s.WriteString(fmt.Sprintf("%s %s", strings.Title(hi.Platform), hi.PlatformVersion))
|
||||
glog.Infof("hostinfo: %+v", hi)
|
||||
} else {
|
||||
glog.Errorf("gopshost.Info returned error: %v", err)
|
||||
s.WriteString(runtime.GOOS)
|
||||
}
|
||||
|
||||
vsys, vrole, err := gopshost.Virtualization()
|
||||
if err != nil {
|
||||
glog.Errorf("gopshost.Virtualization returned error: %v", err)
|
||||
} else {
|
||||
glog.Infof("virtualization: %s %s", vsys, vrole)
|
||||
}
|
||||
|
||||
// This environment is exotic, let's output a bit more.
|
||||
if vrole == "guest" || runtime.GOARCH != "amd64" {
|
||||
s.WriteString(fmt.Sprintf(" (%s/%s)", vsys, runtime.GOARCH))
|
||||
}
|
||||
return s.String()
|
||||
}
|
||||
|
||||
// runStart handles the executes the flow of "minikube start"
|
||||
func runStart(cmd *cobra.Command, args []string) {
|
||||
out.T(out.Happy, "minikube {{.version}} on {{.os}} ({{.arch}})", out.V{"version": version.GetVersion(), "os": runtime.GOOS, "arch": runtime.GOARCH})
|
||||
prefix := ""
|
||||
if viper.GetString(cfg.MachineProfile) != constants.DefaultMachineName {
|
||||
prefix = fmt.Sprintf("[%s]", viper.GetString(cfg.MachineProfile))
|
||||
}
|
||||
out.T(out.Happy, "{{.prefix}}minikube {{.version}} on {{.platform}}", out.V{"prefix": prefix, "version": version.GetVersion(), "platform": platform()})
|
||||
|
||||
vmDriver := viper.GetString(vmDriver)
|
||||
if err := cmdcfg.IsValidDriver(runtime.GOOS, vmDriver); err != nil {
|
||||
|
@ -342,7 +375,7 @@ func skipCache(config *cfg.Config) {
|
|||
|
||||
func showVersionInfo(k8sVersion string, cr cruntime.Manager) {
|
||||
version, _ := cr.Version()
|
||||
out.T(cr.Style(), "Configuring environment for Kubernetes {{.k8sVersion}} on {{.runtime}} {{.runtimeVersion}}", out.V{"k8sVersion": k8sVersion, "runtime": cr.Name(), "runtimeVersion": version})
|
||||
out.T(cr.Style(), "Preparing Kubernetes {{.k8sVersion}} on {{.runtime}} {{.runtimeVersion}} ...", out.V{"k8sVersion": k8sVersion, "runtime": cr.Name(), "runtimeVersion": version})
|
||||
for _, v := range dockerOpt {
|
||||
out.T(out.Option, "opt {{.docker_option}}", out.V{"docker_option": v})
|
||||
}
|
||||
|
@ -355,11 +388,7 @@ func showKubectlConnectInfo(kubeconfig *pkgutil.KubeConfigSetup) {
|
|||
if kubeconfig.KeepContext {
|
||||
out.T(out.Kubectl, "To connect to this cluster, use: kubectl --context={{.name}}", out.V{"name": kubeconfig.ClusterName})
|
||||
} else {
|
||||
if !viper.GetBool(waitUntilHealthy) {
|
||||
out.T(out.Ready, "kubectl has been configured configured to use {{.name}}", out.V{"name": cfg.GetMachineName()})
|
||||
} else {
|
||||
out.T(out.Ready, "Done! kubectl is now configured to use {{.name}}", out.V{"name": cfg.GetMachineName()})
|
||||
}
|
||||
out.T(out.Ready, `Done! kubectl is now configured to use "{{.name}}"`, out.V{"name": cfg.GetMachineName()})
|
||||
}
|
||||
_, err := exec.LookPath("kubectl")
|
||||
if err != nil {
|
||||
|
@ -828,7 +857,7 @@ func bootstrapCluster(bs bootstrapper.Bootstrapper, r cruntime.Manager, runner c
|
|||
}
|
||||
|
||||
if preexisting {
|
||||
out.T(out.Restarting, "Relaunching Kubernetes {{.version}} using {{.bootstrapper}} ... ", out.V{"version": kc.KubernetesVersion, "bootstrapper": bsName})
|
||||
out.T(out.Restarting, "Relaunching Kubernetes using {{.bootstrapper}} ... ", out.V{"bootstrapper": bsName})
|
||||
if err := bs.RestartCluster(kc); err != nil {
|
||||
exit.WithLogEntries("Error restarting cluster", err, logs.FindProblems(r, bs, runner))
|
||||
}
|
||||
|
|
|
@ -409,7 +409,7 @@ func showRemoteOsRelease(driver drivers.Driver) {
|
|||
return
|
||||
}
|
||||
|
||||
out.T(out.Provisioner, "Provisioned with {{.pretty_name}}", out.V{"pretty_name": osReleaseInfo.PrettyName})
|
||||
glog.Infof("Provisioned with %s", osReleaseInfo.PrettyName)
|
||||
}
|
||||
|
||||
func createHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error) {
|
||||
|
|
|
@ -115,7 +115,7 @@ func Output(r cruntime.Manager, bs bootstrapper.Bootstrapper, runner command.Run
|
|||
cmds := logCommands(r, bs, lines, false)
|
||||
|
||||
// These are not technically logs, but are useful to have in bug reports.
|
||||
cmds["kernel"] = "uptime && uname -a"
|
||||
cmds["kernel"] = "uptime && uname -a && grep PRETTY /etc/os-release"
|
||||
|
||||
names := []string{}
|
||||
for k := range cmds {
|
||||
|
|
Loading…
Reference in New Issue