diff --git a/cmd/minikube/cmd/config/addons_list.go b/cmd/minikube/cmd/config/addons_list.go index 8e7dcac94a..481fa7c72e 100644 --- a/cmd/minikube/cmd/config/addons_list.go +++ b/cmd/minikube/cmd/config/addons_list.go @@ -117,7 +117,7 @@ var printAddonsList = func(cc *config.ClusterConfig) { klog.Errorf("list profiles returned error: %v", err) } if len(v) > 1 { - out.Step(style.Tip, "To see addons list for other profiles use: `minikube addons -p name list`", false) + out.Step(style.Tip, false, "To see addons list for other profiles use: `minikube addons -p name list`") } } diff --git a/cmd/minikube/cmd/config/disable.go b/cmd/minikube/cmd/config/disable.go index 3a45104178..778a720b50 100644 --- a/cmd/minikube/cmd/config/disable.go +++ b/cmd/minikube/cmd/config/disable.go @@ -42,7 +42,7 @@ var addonsDisableCmd = &cobra.Command{ if err != nil { exit.Error(reason.InternalDisable, "disable failed", err) } - out.Step(style.AddonDisable, `"The '{{.minikube_addon}}' addon is disabled`, false, out.V{"minikube_addon": addon}) + out.Step(style.AddonDisable, false, `"The '{{.minikube_addon}}' addon is disabled`, out.V{"minikube_addon": addon}) }, } diff --git a/cmd/minikube/cmd/config/enable.go b/cmd/minikube/cmd/config/enable.go index 1c3c9dc6e2..c27475edae 100644 --- a/cmd/minikube/cmd/config/enable.go +++ b/cmd/minikube/cmd/config/enable.go @@ -39,7 +39,7 @@ var addonsEnableCmd = &cobra.Command{ addon := args[0] // replace heapster as metrics-server because heapster is deprecated if addon == "heapster" { - out.Step(style.Waiting, "enable metrics-server addon instead of heapster addon because heapster is deprecated", false) + out.Step(style.Waiting, false, "enable metrics-server addon instead of heapster addon because heapster is deprecated") addon = "metrics-server" } err := addons.SetAndSave(ClusterFlagValue(), addon, "true") @@ -51,15 +51,15 @@ var addonsEnableCmd = &cobra.Command{ if ClusterFlagValue() != constants.DefaultClusterName { tipProfileArg = fmt.Sprintf(" -p %s", ClusterFlagValue()) } - out.Step(style.Tip, `Some dashboard features require the metrics-server addon. To enable all features please run: + out.Step(style.Tip, false, `Some dashboard features require the metrics-server addon. To enable all features please run: minikube{{.profileArg}} addons enable metrics-server -`, false, out.V{"profileArg": tipProfileArg}) +`, out.V{"profileArg": tipProfileArg}) } - out.Step(style.AddonEnable, "The '{{.addonName}}' addon is enabled", false, out.V{"addonName": addon}) + out.Step(style.AddonEnable, false, "The '{{.addonName}}' addon is enabled", out.V{"addonName": addon}) }, } diff --git a/cmd/minikube/cmd/config/open.go b/cmd/minikube/cmd/config/open.go index 50c5b6b45f..a2b8e22f63 100644 --- a/cmd/minikube/cmd/config/open.go +++ b/cmd/minikube/cmd/config/open.go @@ -96,7 +96,7 @@ You can add one by annotating a service with the label {{.labelName}}:{{.addonNa } if len(urlString) != 0 { - out.Step(style.Celebrate, "Opening Kubernetes service {{.namespace_name}}/{{.service_name}} in default browser...", false, out.V{"namespace_name": namespace, "service_name": svc}) + out.Step(style.Celebrate, false, "Opening Kubernetes service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc}) for _, url := range urlString { if err := browser.OpenURL(url); err != nil { exit.Error(reason.HostBrowser, fmt.Sprintf("browser failed to open url %s", url), err) diff --git a/cmd/minikube/cmd/config/profile.go b/cmd/minikube/cmd/config/profile.go index 402ca41a52..beeb93fe70 100644 --- a/cmd/minikube/cmd/config/profile.go +++ b/cmd/minikube/cmd/config/profile.go @@ -37,7 +37,7 @@ var ProfileCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { profile := ClusterFlagValue() - out.Step(style.Empty, profile, false) + out.Step(style.Empty, false, profile) os.Exit(0) } diff --git a/cmd/minikube/cmd/dashboard.go b/cmd/minikube/cmd/dashboard.go index 8e697b89b8..46743314ab 100644 --- a/cmd/minikube/cmd/dashboard.go +++ b/cmd/minikube/cmd/dashboard.go @@ -112,7 +112,7 @@ var dashboardCmd = &cobra.Command{ if dashboardURLMode || user.Uid == "0" { out.Ln(url) } else { - out.Step(style.Celebrate, "Opening {{.url}} in your default browser...", false, out.V{"url": url}) + out.Step(style.Celebrate, false, "Opening {{.url}} in your default browser...", out.V{"url": url}) if err = browser.OpenURL(url); err != nil { exit.Message(reason.HostBrowser, "failed to open browser: {{.error}}", out.V{"error": err}) } diff --git a/cmd/minikube/cmd/delete.go b/cmd/minikube/cmd/delete.go index 8ffb033ddb..a19d9493dd 100644 --- a/cmd/minikube/cmd/delete.go +++ b/cmd/minikube/cmd/delete.go @@ -142,7 +142,7 @@ func runDelete(cmd *cobra.Command, args []string) { if purge && len(profilesToDelete) > 1 && !deleteAll { out.ErrT(style.Notice, "Multiple minikube profiles were found - ") for _, p := range profilesToDelete { - out.Step(style.Notice, " - {{.profile}}", false, out.V{"profile": p.Name}) + out.Step(style.Notice, false, " - {{.profile}}", out.V{"profile": p.Name}) } exit.Message(reason.Usage, "Usage: minikube delete --all --purge") } @@ -157,7 +157,7 @@ func runDelete(cmd *cobra.Command, args []string) { if len(errs) > 0 { HandleDeletionErrors(errs) } else { - out.Step(style.DeletingHost, "Successfully deleted all profiles", false) + out.Step(style.DeletingHost, false, "Successfully deleted all profiles") } } else { if len(args) > 0 { @@ -198,7 +198,7 @@ func purgeMinikubeDirectory() { if err := os.RemoveAll(localpath.MiniPath()); err != nil { exit.Error(reason.HostPurge, "unable to delete minikube config folder", err) } - out.Step(style.Deleted, "Successfully purged minikube directory located at - [{{.minikubeDirectory}}]", false, out.V{"minikubeDirectory": localpath.MiniPath()}) + out.Step(style.Deleted, false, "Successfully purged minikube directory located at - [{{.minikubeDirectory}}]", out.V{"minikubeDirectory": localpath.MiniPath()}) } // DeleteProfiles deletes one or more profiles @@ -246,7 +246,7 @@ func deletePossibleKicLeftOver(cname string, driverName string) { cs, err := oci.ListContainersByLabel(bin, delLabel) if err == nil && len(cs) > 0 { for _, c := range cs { - out.Step(style.DeletingHost, `Deleting container "{{.name}}" ...`, false, out.V{"name": cname}) + out.Step(style.DeletingHost, false, `Deleting container "{{.name}}" ...`, out.V{"name": cname}) err := oci.DeleteContainer(bin, c) if err != nil { // it will error if there is no container to delete klog.Errorf("error deleting container %q. You may want to delete it manually :\n%v", cname, err) @@ -286,7 +286,7 @@ func deleteProfile(profile *config.Profile) error { // if driver is oci driver, delete containers and volumes if driver.IsKIC(profile.Config.Driver) { - out.Step(style.DeletingHost, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, false, out.V{"profile_name": profile.Name, "driver_name": profile.Config.Driver}) + out.Step(style.DeletingHost, false, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, out.V{"profile_name": profile.Name, "driver_name": profile.Config.Driver}) for _, n := range profile.Config.Nodes { machineName := driver.MachineName(*profile.Config, n) deletePossibleKicLeftOver(machineName, profile.Config.Driver) @@ -337,7 +337,7 @@ func deleteProfile(profile *config.Profile) error { if err := deleteContext(profile.Name); err != nil { return err } - out.Step(style.Deleted, `Removed all traces of the "{{.name}}" cluster.`, false, out.V{"name": profile.Name}) + out.Step(style.Deleted, false, `Removed all traces of the "{{.name}}" cluster.`, out.V{"name": profile.Name}) return nil } @@ -353,7 +353,7 @@ func deleteHosts(api libmachine.API, cc *config.ClusterConfig) { klog.Infof("Host %s does not exist. Proceeding ahead with cleanup.", machineName) default: out.FailureT("Failed to delete cluster: {{.error}}", out.V{"error": err}) - out.Step(style.Notice, `You may need to manually remove the "{{.name}}" VM from your hypervisor`, false, out.V{"name": machineName}) + out.Step(style.Notice, false, `You may need to manually remove the "{{.name}}" VM from your hypervisor`, out.V{"name": machineName}) } } } @@ -384,7 +384,7 @@ func deleteContext(machineName string) error { } func deleteInvalidProfile(profile *config.Profile) []error { - out.Step(style.DeletingHost, "Trying to delete invalid profile {{.profile}}", false, out.V{"profile": profile.Name}) + out.Step(style.DeletingHost, false, "Trying to delete invalid profile {{.profile}}", out.V{"profile": profile.Name}) var errs []error pathToProfile := config.ProfileFolderPath(profile.Name, localpath.MiniPath()) @@ -410,7 +410,7 @@ func profileDeletionErr(cname string, additionalInfo string) error { } func uninstallKubernetes(api libmachine.API, cc config.ClusterConfig, n config.Node, bsName string) error { - out.Step(style.Resetting, "Uninstalling Kubernetes {{.kubernetes_version}} using {{.bootstrapper_name}} ...", false, out.V{"kubernetes_version": cc.KubernetesConfig.KubernetesVersion, "bootstrapper_name": bsName}) + out.Step(style.Resetting, false, "Uninstalling Kubernetes {{.kubernetes_version}} using {{.bootstrapper_name}} ...", out.V{"kubernetes_version": cc.KubernetesConfig.KubernetesVersion, "bootstrapper_name": bsName}) host, err := machine.LoadHost(api, driver.MachineName(cc, n)) if err != nil { return DeletionError{Err: fmt.Errorf("unable to load host: %v", err), Errtype: MissingCluster} @@ -488,7 +488,7 @@ func handleMultipleDeletionErrors(errors []error) { func deleteProfileDirectory(profile string) { machineDir := filepath.Join(localpath.MiniPath(), "machines", profile) if _, err := os.Stat(machineDir); err == nil { - out.Step(style.DeletingHost, `Removing {{.directory}} ...`, false, out.V{"directory": machineDir}) + out.Step(style.DeletingHost, false, `Removing {{.directory}} ...`, out.V{"directory": machineDir}) err := os.RemoveAll(machineDir) if err != nil { exit.Error(reason.GuestProfileDeletion, "Unable to remove machine directory", err) diff --git a/cmd/minikube/cmd/generate-docs.go b/cmd/minikube/cmd/generate-docs.go index e6af98fdd9..bd6ab9e839 100644 --- a/cmd/minikube/cmd/generate-docs.go +++ b/cmd/minikube/cmd/generate-docs.go @@ -47,7 +47,7 @@ var generateDocs = &cobra.Command{ if err := generate.Docs(RootCmd, path); err != nil { exit.Error(reason.InternalGenerateDocs, "Unable to generate docs", err) } - out.Step(style.Documentation, "Docs have been saved at - {{.path}}", false, out.V{"path": path}) + out.Step(style.Documentation, false, "Docs have been saved at - {{.path}}", out.V{"path": path}) }, } diff --git a/cmd/minikube/cmd/mount.go b/cmd/minikube/cmd/mount.go index 43425fa605..e673341e5e 100644 --- a/cmd/minikube/cmd/mount.go +++ b/cmd/minikube/cmd/mount.go @@ -154,7 +154,7 @@ var mountCmd = &cobra.Command{ if driver.IsKIC(co.CP.Host.Driver.DriverName()) && runtime.GOOS != "linux" { bindIP = "127.0.0.1" } - out.Step(style.Mounting, "Mounting host path {{.sourcePath}} into VM as {{.destinationPath}} ...", false, out.V{"sourcePath": hostPath, "destinationPath": vmPath}) + out.Step(style.Mounting, false, "Mounting host path {{.sourcePath}} into VM as {{.destinationPath}} ...", out.V{"sourcePath": hostPath, "destinationPath": vmPath}) out.Infof("Mount type: {{.name}}", out.V{"type": cfg.Type}) out.Infof("User ID: {{.userID}}", out.V{"userID": cfg.UID}) out.Infof("Group ID: {{.groupID}}", out.V{"groupID": cfg.GID}) @@ -168,9 +168,9 @@ var mountCmd = &cobra.Command{ if cfg.Type == nineP { wg.Add(1) go func() { - out.Step(style.Fileserver, "Userspace file server: ", false) + out.Step(style.Fileserver, false, "Userspace file server: ") ufs.StartServer(net.JoinHostPort(bindIP, strconv.Itoa(port)), debugVal, hostPath) - out.Step(style.Stopped, "Userspace file server is shutdown", false) + out.Step(style.Stopped, false, "Userspace file server is shutdown") wg.Done() }() } @@ -180,7 +180,7 @@ var mountCmd = &cobra.Command{ signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { for sig := range c { - out.Step(style.Unmount, "Unmounting {{.path}} ...", false, out.V{"path": vmPath}) + out.Step(style.Unmount, false, "Unmounting {{.path}} ...", out.V{"path": vmPath}) err := cluster.Unmount(co.CP.Runner, vmPath) if err != nil { out.FailureT("Failed unmount: {{.error}}", out.V{"error": err}) @@ -193,9 +193,9 @@ var mountCmd = &cobra.Command{ if err != nil { exit.Error(reason.GuestMount, "mount failed", err) } - out.Step(style.Success, "Successfully mounted {{.sourcePath}} to {{.destinationPath}}", false, out.V{"sourcePath": hostPath, "destinationPath": vmPath}) + out.Step(style.Success, false, "Successfully mounted {{.sourcePath}} to {{.destinationPath}}", out.V{"sourcePath": hostPath, "destinationPath": vmPath}) out.Ln("") - out.Step(style.Notice, "NOTE: This process must stay alive for the mount to be accessible ...", false) + out.Step(style.Notice, false, "NOTE: This process must stay alive for the mount to be accessible ...") wg.Wait() }, } diff --git a/cmd/minikube/cmd/node_add.go b/cmd/minikube/cmd/node_add.go index 83923ecc76..4eed2980eb 100644 --- a/cmd/minikube/cmd/node_add.go +++ b/cmd/minikube/cmd/node_add.go @@ -48,7 +48,7 @@ var nodeAddCmd = &cobra.Command{ name := node.Name(len(cc.Nodes) + 1) - out.Step(style.Happy, "Adding node {{.name}} to cluster {{.cluster}}", false, out.V{"name": name, "cluster": cc.Name}) + out.Step(style.Happy, false, "Adding node {{.name}} to cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name}) // TODO: Deal with parameters better. Ideally we should be able to acceot any node-specific minikube start params here. n := config.Node{ @@ -77,7 +77,7 @@ var nodeAddCmd = &cobra.Command{ exit.Error(reason.HostSaveProfile, "failed to save config", err) } - out.Step(style.Ready, "Successfully added {{.name}} to {{.cluster}}!", false, out.V{"name": name, "cluster": cc.Name}) + out.Step(style.Ready, false, "Successfully added {{.name}} to {{.cluster}}!", out.V{"name": name, "cluster": cc.Name}) }, } diff --git a/cmd/minikube/cmd/node_delete.go b/cmd/minikube/cmd/node_delete.go index b1554eca0b..047c6e3720 100644 --- a/cmd/minikube/cmd/node_delete.go +++ b/cmd/minikube/cmd/node_delete.go @@ -38,7 +38,7 @@ var nodeDeleteCmd = &cobra.Command{ name := args[0] co := mustload.Healthy(ClusterFlagValue()) - out.Step(style.DeletingHost, "Deleting node {{.name}} from cluster {{.cluster}}", false, out.V{"name": name, "cluster": co.Config.Name}) + out.Step(style.DeletingHost, false, "Deleting node {{.name}} from cluster {{.cluster}}", out.V{"name": name, "cluster": co.Config.Name}) n, err := node.Delete(*co.Config, name) if err != nil { @@ -50,7 +50,7 @@ var nodeDeleteCmd = &cobra.Command{ deletePossibleKicLeftOver(machineName, co.Config.Driver) } - out.Step(style.Deleted, "Node {{.name}} was successfully deleted.", false, out.V{"name": name}) + out.Step(style.Deleted, false, "Node {{.name}} was successfully deleted.", out.V{"name": name}) }, } diff --git a/cmd/minikube/cmd/node_start.go b/cmd/minikube/cmd/node_start.go index 1c9e0ae539..f2740dda63 100644 --- a/cmd/minikube/cmd/node_start.go +++ b/cmd/minikube/cmd/node_start.go @@ -50,7 +50,7 @@ var nodeStartCmd = &cobra.Command{ machineName := driver.MachineName(*cc, *n) if machine.IsRunning(api, machineName) { - out.Step(style.Check, "{{.name}} is already running", false, out.V{"name": name}) + out.Step(style.Check, false, "{{.name}} is already running", out.V{"name": name}) os.Exit(0) } @@ -77,7 +77,7 @@ var nodeStartCmd = &cobra.Command{ exit.Error(reason.GuestNodeStart, "failed to start node", err) } } - out.Step(style.Happy, "Successfully started node {{.name}}!", false, out.V{"name": machineName}) + out.Step(style.Happy, false, "Successfully started node {{.name}}!", out.V{"name": machineName}) }, } diff --git a/cmd/minikube/cmd/node_stop.go b/cmd/minikube/cmd/node_stop.go index 67981cdf45..2508808308 100644 --- a/cmd/minikube/cmd/node_stop.go +++ b/cmd/minikube/cmd/node_stop.go @@ -51,7 +51,7 @@ var nodeStopCmd = &cobra.Command{ if err != nil { out.FatalT("Failed to stop node {{.name}}", out.V{"name": name}) } - out.Step(style.Stopped, "Successfully stopped node {{.name}}", false, out.V{"name": machineName}) + out.Step(style.Stopped, false, "Successfully stopped node {{.name}}", out.V{"name": machineName}) }, } diff --git a/cmd/minikube/cmd/pause.go b/cmd/minikube/cmd/pause.go index 8c69efdf23..f2a3c3e1d5 100644 --- a/cmd/minikube/cmd/pause.go +++ b/cmd/minikube/cmd/pause.go @@ -71,7 +71,7 @@ func runPause(cmd *cobra.Command, args []string) { name = co.Config.Name } - out.Step(style.Pause, "Pausing node {{.name}} ... ", false, out.V{"name": name}) + out.Step(style.Pause, false, "Pausing node {{.name}} ... ", out.V{"name": name}) host, err := machine.LoadHost(co.API, driver.MachineName(*co.Config, n)) if err != nil { @@ -97,9 +97,9 @@ func runPause(cmd *cobra.Command, args []string) { register.Reg.SetStep(register.Done) if namespaces == nil { - out.Step(style.Unpause, "Paused {{.count}} containers", false, out.V{"count": len(ids)}) + out.Step(style.Unpause, false, "Paused {{.count}} containers", out.V{"count": len(ids)}) } else { - out.Step(style.Unpause, "Paused {{.count}} containers in: {{.namespaces}}", false, out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")}) + out.Step(style.Unpause, false, "Paused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")}) } } diff --git a/cmd/minikube/cmd/service.go b/cmd/minikube/cmd/service.go index 97c6488248..cef2055b54 100644 --- a/cmd/minikube/cmd/service.go +++ b/cmd/minikube/cmd/service.go @@ -164,7 +164,7 @@ func openURLs(svc string, urls []string) { continue } - out.Step(style.Celebrate, "Opening service {{.namespace_name}}/{{.service_name}} in default browser...", false, out.V{"namespace_name": namespace, "service_name": svc}) + out.Step(style.Celebrate, false, "Opening service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc}) if err := browser.OpenURL(u); err != nil { exit.Error(reason.HostBrowser, fmt.Sprintf("open url failed: %s", u), err) } diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 3f71298480..08231b6e07 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -300,7 +300,7 @@ func provisionWithDriver(cmd *cobra.Command, ds registry.DriverState, existing * // This is about as far as we can go without overwriting config files if viper.GetBool(dryRun) { - out.Step(style.DryRun, `dry-run validation complete!`, false) + out.Step(style.DryRun, false, `dry-run validation complete!`) os.Exit(0) } @@ -400,7 +400,7 @@ func startWithDriver(cmd *cobra.Command, starter node.Starter, existing *config. func warnAboutMultiNode() { out.WarningT("Multi-node clusters are currently experimental and might exhibit unintended behavior.") - out.Step(style.Documentation, "To track progress on multi-node clusters, see https://github.com/kubernetes/minikube/issues/7538.", false) + out.Step(style.Documentation, false, "To track progress on multi-node clusters, see https://github.com/kubernetes/minikube/issues/7538.") } func updateDriver(driverName string) { @@ -419,7 +419,7 @@ func displayVersion(version string) { } register.Reg.SetStep(register.InitialSetup) - out.Step(style.Happy, "{{.prefix}}minikube {{.version}} on {{.platform}}", false, out.V{"prefix": prefix, "version": version, "platform": platform()}) + out.Step(style.Happy, false, "{{.prefix}}minikube {{.version}} on {{.platform}}", out.V{"prefix": prefix, "version": version, "platform": platform()}) } // displayEnviron makes the user aware of environment variables that will affect how minikube operates @@ -439,15 +439,15 @@ func showKubectlInfo(kcs *kubeconfig.Settings, k8sVersion string, machineName st defer func() { register.Reg.SetStep(register.Done) if kcs.KeepContext { - out.Step(style.Kubectl, "To connect to this cluster, use: --context={{.name}}", false, out.V{"name": kcs.ClusterName}) + out.Step(style.Kubectl, false, "To connect to this cluster, use: --context={{.name}}", out.V{"name": kcs.ClusterName}) } else { - out.Step(style.Ready, `Done! kubectl is now configured to use "{{.name}}" cluster and "{{.ns}}" namespace by default`, false, out.V{"name": machineName, "ns": kcs.Namespace}) + out.Step(style.Ready, false, `Done! kubectl is now configured to use "{{.name}}" cluster and "{{.ns}}" namespace by default`, out.V{"name": machineName, "ns": kcs.Namespace}) } }() path, err := exec.LookPath("kubectl") if err != nil { - out.Step(style.Tip, "kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'", false) + out.Step(style.Tip, false, "kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'") return nil } @@ -556,7 +556,7 @@ func selectDriver(existing *config.ClusterConfig) (registry.DriverState, []regis if existing != nil { old := hostDriver(existing) ds := driver.Status(old) - out.Step(style.Sparkle, `Using the {{.driver}} driver based on existing profile`, false, out.V{"driver": ds.String()}) + out.Step(style.Sparkle, false, `Using the {{.driver}} driver based on existing profile`, out.V{"driver": ds.String()}) return ds, nil, true } @@ -576,7 +576,7 @@ func selectDriver(existing *config.ClusterConfig) (registry.DriverState, []regis if ds.Name == "" { exit.Message(reason.DrvUnsupportedOS, "The driver '{{.driver}}' is not supported on {{.os}}", out.V{"driver": d, "os": runtime.GOOS}) } - out.Step(style.Sparkle, `Using the {{.driver}} driver based on user configuration`, false, out.V{"driver": ds.String()}) + out.Step(style.Sparkle, false, `Using the {{.driver}} driver based on user configuration`, out.V{"driver": ds.String()}) return ds, nil, true } @@ -586,14 +586,14 @@ func selectDriver(existing *config.ClusterConfig) (registry.DriverState, []regis if ds.Name == "" { exit.Message(reason.DrvUnsupportedOS, "The driver '{{.driver}}' is not supported on {{.os}}", out.V{"driver": d, "os": runtime.GOOS}) } - out.Step(style.Sparkle, `Using the {{.driver}} driver based on user configuration`, false, out.V{"driver": ds.String()}) + out.Step(style.Sparkle, false, `Using the {{.driver}} driver based on user configuration`, out.V{"driver": ds.String()}) return ds, nil, true } choices := driver.Choices(viper.GetBool("vm")) pick, alts, rejects := driver.Suggest(choices) if pick.Name == "" { - out.Step(style.ThumbsDown, "Unable to pick a default driver. Here is what was considered, in preference order:", false) + out.Step(style.ThumbsDown, false, "Unable to pick a default driver. Here is what was considered, in preference order:") for _, r := range rejects { out.Infof("{{ .name }}: {{ .rejection }}", out.V{"name": r.Name, "rejection": r.Rejection}) } @@ -605,9 +605,9 @@ func selectDriver(existing *config.ClusterConfig) (registry.DriverState, []regis for _, a := range alts { altNames = append(altNames, a.String()) } - out.Step(style.Sparkle, `Automatically selected the {{.driver}} driver. Other choices: {{.alternates}}`, false, out.V{"driver": pick.Name, "alternates": strings.Join(altNames, ", ")}) + out.Step(style.Sparkle, false, `Automatically selected the {{.driver}} driver. Other choices: {{.alternates}}`, out.V{"driver": pick.Name, "alternates": strings.Join(altNames, ", ")}) } else { - out.Step(style.Sparkle, `Automatically selected the {{.driver}} driver`, false, out.V{"driver": pick.String()}) + out.Step(style.Sparkle, false, `Automatically selected the {{.driver}} driver`, out.V{"driver": pick.String()}) } return pick, alts, false } @@ -702,7 +702,7 @@ func validateDriver(ds registry.DriverState, existing *config.ClusterConfig) { klog.Infof("status for %s: %+v", name, st) if st.NeedsImprovement { - out.Step(style.Improvement, `For improved {{.driver}} performance, {{.fix}}`, false, out.V{"driver": driver.FullName(ds.Name), "fix": translate.T(st.Fix)}) + out.Step(style.Improvement, false, `For improved {{.driver}} performance, {{.fix}}`, out.V{"driver": driver.FullName(ds.Name), "fix": translate.T(st.Fix)}) } if st.Error == nil { @@ -967,7 +967,7 @@ func validateCPUCount(drvName string) { si, err := oci.CachedDaemonInfo(drvName) if err != nil { - out.Step(style.Confused, "Failed to verify '{{.driver_name}} info' will try again ...", false, out.V{"driver_name": drvName}) + out.Step(style.Confused, false, "Failed to verify '{{.driver_name}} info' will try again ...", out.V{"driver_name": drvName}) si, err = oci.DaemonInfo(drvName) if err != nil { exit.Message(reason.Usage, "Ensure your {{.driver_name}} is running and is healthy.", out.V{"driver_name": driver.FullName(drvName)}) @@ -1219,7 +1219,7 @@ func validateKubernetesVersion(old *config.ClusterConfig) { } if defaultVersion.GT(nvs) { - out.Step(style.New, "Kubernetes {{.new}} is now available. If you would like to upgrade, specify: --kubernetes-version={{.prefix}}{{.new}}", false, out.V{"prefix": version.VersionPrefix, "new": defaultVersion}) + out.Step(style.New, false, "Kubernetes {{.new}} is now available. If you would like to upgrade, specify: --kubernetes-version={{.prefix}}{{.new}}", out.V{"prefix": version.VersionPrefix, "new": defaultVersion}) } } diff --git a/cmd/minikube/cmd/start_flags.go b/cmd/minikube/cmd/start_flags.go index b53e9ad6c3..8803d043d5 100644 --- a/cmd/minikube/cmd/start_flags.go +++ b/cmd/minikube/cmd/start_flags.go @@ -278,7 +278,7 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k } if cmd.Flags().Changed(imageRepository) || cmd.Flags().Changed(imageMirrorCountry) { - out.Step(style.Success, "Using image repository {{.name}}", false, out.V{"name": repository}) + out.Step(style.Success, false, "Using image repository {{.name}}", out.V{"name": repository}) } // Backwards compatibility with --enable-default-cni diff --git a/cmd/minikube/cmd/stop.go b/cmd/minikube/cmd/stop.go index 4f8b51bfb5..9d63808a8c 100644 --- a/cmd/minikube/cmd/stop.go +++ b/cmd/minikube/cmd/stop.go @@ -117,7 +117,7 @@ func runStop(cmd *cobra.Command, args []string) { register.Reg.SetStep(register.Done) if stoppedNodes > 0 { - out.Step(style.Stopped, `{{.count}} nodes stopped.`, false, out.V{"count": stoppedNodes}) + out.Step(style.Stopped, false, `{{.count}} nodes stopped.`, out.V{"count": stoppedNodes}) } } @@ -163,7 +163,7 @@ func stop(api libmachine.API, machineName string) bool { switch err := errors.Cause(err).(type) { case mcnerror.ErrHostDoesNotExist: - out.Step(style.Meh, `"{{.machineName}}" does not exist, nothing to stop`, false, out.V{"machineName": machineName}) + out.Step(style.Meh, false, `"{{.machineName}}" does not exist, nothing to stop`, out.V{"machineName": machineName}) nonexistent = true return nil default: diff --git a/cmd/minikube/cmd/unpause.go b/cmd/minikube/cmd/unpause.go index ca0871a074..bb866dfc9d 100644 --- a/cmd/minikube/cmd/unpause.go +++ b/cmd/minikube/cmd/unpause.go @@ -69,7 +69,7 @@ var unpauseCmd = &cobra.Command{ name = co.Config.Name } - out.Step(style.Pause, "Unpausing node {{.name}} ... ", false, out.V{"name": name}) + out.Step(style.Pause, false, "Unpausing node {{.name}} ... ", out.V{"name": name}) machineName := driver.MachineName(*co.Config, n) host, err := machine.LoadHost(co.API, machineName) @@ -97,9 +97,9 @@ var unpauseCmd = &cobra.Command{ register.Reg.SetStep(register.Done) if namespaces == nil { - out.Step(style.Pause, "Unpaused {{.count}} containers", false, out.V{"count": len(ids)}) + out.Step(style.Pause, false, "Unpaused {{.count}} containers", out.V{"count": len(ids)}) } else { - out.Step(style.Pause, "Unpaused {{.count}} containers in: {{.namespaces}}", false, out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")}) + out.Step(style.Pause, false, "Unpaused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")}) } }, } diff --git a/cmd/minikube/cmd/update-context.go b/cmd/minikube/cmd/update-context.go index f99f03566f..1ac5a26997 100644 --- a/cmd/minikube/cmd/update-context.go +++ b/cmd/minikube/cmd/update-context.go @@ -41,15 +41,15 @@ var updateContextCmd = &cobra.Command{ exit.Error(reason.HostKubeconfigUpdate, "update config", err) } if updated { - out.Step(style.Celebrate, `"{{.context}}" context has been updated to point to {{.hostname}}:{{.port}}`, false, out.V{"context": cname, "hostname": co.CP.Hostname, "port": co.CP.Port}) + out.Step(style.Celebrate, false, `"{{.context}}" context has been updated to point to {{.hostname}}:{{.port}}`, out.V{"context": cname, "hostname": co.CP.Hostname, "port": co.CP.Port}) } else { - out.Step(style.Meh, `No changes required for the "{{.context}}" context`, false, out.V{"context": cname}) + out.Step(style.Meh, false, `No changes required for the "{{.context}}" context`, out.V{"context": cname}) } if err := kubeconfig.SetCurrentContext(cname, kubeconfig.PathFromEnv()); err != nil { out.ErrT(style.Sad, `Error while setting kubectl current context: {{.error}}`, out.V{"error": err}) } else { - out.Step(style.Kubectl, `Current context is "{{.context}}"`, false, out.V{"context": cname}) + out.Step(style.Kubectl, false, `Current context is "{{.context}}"`, out.V{"context": cname}) } }, } diff --git a/pkg/addons/addons.go b/pkg/addons/addons.go index 81848de8c0..e92f579598 100644 --- a/pkg/addons/addons.go +++ b/pkg/addons/addons.go @@ -195,8 +195,8 @@ https://github.com/kubernetes/minikube/issues/7332`, out.V{"driver_name": cc.Dri if err != nil { return errors.Wrap(err, "registry port") } - out.Step(style.Tip, `Registry addon on with {{.driver}} uses {{.port}} please use that instead of default 5000`, false, out.V{"driver": cc.Driver, "port": port}) - out.Step(style.Documentation, `For more information see: https://minikube.sigs.k8s.io/docs/drivers/{{.driver}}`, false, out.V{"driver": cc.Driver}) + out.Step(style.Tip, false, `Registry addon on with {{.driver}} uses {{.port}} please use that instead of default 5000`, out.V{"driver": cc.Driver, "port": port}) + out.Step(style.Documentation, false, `For more information see: https://minikube.sigs.k8s.io/docs/drivers/{{.driver}}`, out.V{"driver": cc.Driver}) } } @@ -331,8 +331,8 @@ func verifyGCPAuthAddon(cc *config.ClusterConfig, name string, val string) error err = verifyAddonStatusInternal(cc, name, val, "gcp-auth") if enable && err == nil { - out.Step(style.Notice, "Your GCP credentials will now be mounted into every pod created in the {{.name}} cluster.", false, out.V{"name": cc.Name}) - out.Step(style.Notice, "If you don't want your credentials mounted into a specific pod, add a label with the `gcp-auth-skip-secret` key to your pod configuration.", false) + out.Step(style.Notice, false, "Your GCP credentials will now be mounted into every pod created in the {{.name}} cluster.", out.V{"name": cc.Name}) + out.Step(style.Notice, false, "If you don't want your credentials mounted into a specific pod, add a label with the `gcp-auth-skip-secret` key to your pod configuration.") } return err @@ -347,7 +347,7 @@ func verifyAddonStatusInternal(cc *config.ClusterConfig, name string, val string label, ok := addonPodLabels[name] if ok && enable { - out.Step(style.HealthCheck, "Verifying {{.addon_name}} addon...", false, out.V{"addon_name": name}) + out.Step(style.HealthCheck, false,"Verifying {{.addon_name}} addon...", out.V{"addon_name": name}) client, err := kapi.Client(viper.GetString(config.ProfileName)) if err != nil { return errors.Wrapf(err, "get kube-client to validate %s addon: %v", name, err) @@ -410,7 +410,7 @@ func Start(wg *sync.WaitGroup, cc *config.ClusterConfig, toEnable map[string]boo defer func() { // making it show after verifications (see #7613) register.Reg.SetStep(register.EnablingAddons) - out.Step(style.AddonEnable, "Enabled addons: {{.addons}}", false, out.V{"addons": strings.Join(enabledAddons, ", ")}) + out.Step(style.AddonEnable, false,"Enabled addons: {{.addons}}", out.V{"addons": strings.Join(enabledAddons, ", ")}) }() for _, a := range toEnableList { awg.Add(1) diff --git a/pkg/addons/gcpauth/enable.go b/pkg/addons/gcpauth/enable.go index 36fa2abce2..285c8e7396 100644 --- a/pkg/addons/gcpauth/enable.go +++ b/pkg/addons/gcpauth/enable.go @@ -103,11 +103,11 @@ func enableAddon(cfg *config.ClusterConfig) error { } out.WarningT("Could not determine a Google Cloud project, which might be ok.") - out.Step(style.Tip, `To set your Google Cloud project, run: + out.Step(style.Tip, false, `To set your Google Cloud project, run: gcloud config set project -or set the GOOGLE_CLOUD_PROJECT environment variable.`, false) +or set the GOOGLE_CLOUD_PROJECT environment variable.`) // Copy an empty file in to avoid errors about missing files emptyFile := assets.NewMemoryAssetTarget([]byte{}, projectPath, "0444") diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index e6c4528fba..fea3128d49 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -283,7 +283,7 @@ func (k *Bootstrapper) applyCNI(cfg config.ClusterConfig) error { return nil } - out.Step(style.CNI, "Configuring {{.name}} (Container Networking Interface) ...", false, out.V{"name": cnm.String()}) + out.Step(style.CNI, false, "Configuring {{.name}} (Container Networking Interface) ...", out.V{"name": cnm.String()}) if err := cnm.Apply(k.c); err != nil { return errors.Wrap(err, "cni apply") @@ -393,7 +393,7 @@ func (k *Bootstrapper) client(ip string, port int) (*kubernetes.Clientset, error func (k *Bootstrapper) WaitForNode(cfg config.ClusterConfig, n config.Node, timeout time.Duration) error { start := time.Now() register.Reg.SetStep(register.VerifyingKubernetes) - out.Step(style.HealthCheck, "Verifying Kubernetes components...", false) + out.Step(style.HealthCheck, false, "Verifying Kubernetes components...") // regardless if waiting is set or not, we will make sure kubelet is not stopped // to solve corner cases when a container is hibernated and once coming back kubelet not running. if err := k.ensureServiceStarted("kubelet"); err != nil { @@ -968,16 +968,16 @@ func adviseNodePressure(err error, name string, drv string) { klog.Warning(diskErr) out.WarningT("The node {{.name}} has ran out of disk space.", out.V{"name": name}) // generic advice for all drivers - out.Step(style.Tip, "Please free up disk or prune images.", false) + out.Step(style.Tip, false, "Please free up disk or prune images.") if driver.IsVM(drv) { - out.Step(style.Stopped, "Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ", false) + out.Step(style.Stopped, false, "Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ") } else if drv == oci.Docker && runtime.GOOS != "linux" { - out.Step(style.Stopped, "Please increse Desktop's disk size.", false) + out.Step(style.Stopped, false, "Please increse Desktop's disk size.") if runtime.GOOS == "darwin" { - out.Step(style.Documentation, "Documentation: {{.url}}", false, out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) + out.Step(style.Documentation, false, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) } if runtime.GOOS == "windows" { - out.Step(style.Documentation, "Documentation: {{.url}}", false, out.V{"url": "https://docs.docker.com/docker-for-windows/"}) + out.Step(style.Documentation, false, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-windows/"}) } } out.ErrLn("") @@ -988,16 +988,16 @@ func adviseNodePressure(err error, name string, drv string) { out.ErrLn("") klog.Warning(memErr) out.WarningT("The node {{.name}} has ran out of memory.", out.V{"name": name}) - out.Step(style.Tip, "Check if you have unnecessary pods running by running 'kubectl get po -A", false) + out.Step(style.Tip, false, "Check if you have unnecessary pods running by running 'kubectl get po -A") if driver.IsVM(drv) { - out.Step(style.Stopped, "Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ", false) + out.Step(style.Stopped, false,"Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ") } else if drv == oci.Docker && runtime.GOOS != "linux" { - out.Step(style.Stopped, "Consider increasing Docker Desktop's memory size.", false) + out.Step(style.Stopped, false, "Consider increasing Docker Desktop's memory size.") if runtime.GOOS == "darwin" { - out.Step(style.Documentation, "Documentation: {{.url}}", false, out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) + out.Step(style.Documentation, false, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) } if runtime.GOOS == "windows" { - out.Step(style.Documentation, "Documentation: {{.url}}", false, out.V{"url": "https://docs.docker.com/docker-for-windows/"}) + out.Step(style.Documentation, false,"Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-windows/"}) } } out.ErrLn("") diff --git a/pkg/minikube/browser/browser.go b/pkg/minikube/browser/browser.go index ee262c7006..193016528f 100644 --- a/pkg/minikube/browser/browser.go +++ b/pkg/minikube/browser/browser.go @@ -30,7 +30,7 @@ func OpenURL(url string) error { if runtime.GOOS == "linux" { _, err := exec.LookPath("xdg-open") if err != nil { - out.Step(style.URL, url, false) + out.Step(style.URL, false, url) return nil } } diff --git a/pkg/minikube/download/driver.go b/pkg/minikube/download/driver.go index ef7cda1814..e5945721e1 100644 --- a/pkg/minikube/download/driver.go +++ b/pkg/minikube/download/driver.go @@ -33,7 +33,7 @@ func driverWithChecksumURL(name string, v semver.Version) string { // Driver downloads an arbitrary driver func Driver(name string, destination string, v semver.Version) error { - out.Step(style.FileDownload, "Downloading driver {{.driver}}:", false, out.V{"driver": name}) + out.Step(style.FileDownload, false, "Downloading driver {{.driver}}:", out.V{"driver": name}) if err := download(driverWithChecksumURL(name, v), destination); err != nil { return errors.Wrap(err, "download") } diff --git a/pkg/minikube/download/iso.go b/pkg/minikube/download/iso.go index 77bd576909..4a5e46e0e1 100644 --- a/pkg/minikube/download/iso.go +++ b/pkg/minikube/download/iso.go @@ -127,7 +127,7 @@ func downloadISO(isoURL string, skipChecksum bool) error { return nil } - out.Step(style.ISODownload, "Downloading VM boot image ...", false) + out.Step(style.ISODownload, false, "Downloading VM boot image ...") urlWithChecksum := isoURL + "?checksum=file:" + isoURL + ".sha256" if skipChecksum { diff --git a/pkg/minikube/download/preload.go b/pkg/minikube/download/preload.go index f11f0be0cc..07682aea3b 100644 --- a/pkg/minikube/download/preload.go +++ b/pkg/minikube/download/preload.go @@ -138,7 +138,7 @@ func Preload(k8sVersion, containerRuntime string) error { return nil } - out.Step(style.FileDownload, "Downloading Kubernetes {{.version}} preload ...", false, out.V{"version": k8sVersion}) + out.Step(style.FileDownload, false, "Downloading Kubernetes {{.version}} preload ...", out.V{"version": k8sVersion}) url := remoteTarballURL(k8sVersion, containerRuntime) if err := download(url, targetPath); err != nil { diff --git a/pkg/minikube/driver/install.go b/pkg/minikube/driver/install.go index ac1b009212..59ccaf6b64 100644 --- a/pkg/minikube/driver/install.go +++ b/pkg/minikube/driver/install.go @@ -91,7 +91,7 @@ func fixDriverPermissions(name string, path string, interactive bool) error { example.WriteString(fmt.Sprintf(" $ %s \n", strings.Join(c.Args, " "))) } - out.Step(style.Permissions, "The '{{.driver}}' driver requires elevated permissions. The following commands will be executed:\n\n{{ .example }}\n", false, out.V{"driver": name, "example": example.String()}) + out.Step(style.Permissions, false, "The '{{.driver}}' driver requires elevated permissions. The following commands will be executed:\n\n{{ .example }}\n", out.V{"driver": name, "example": example.String()}) for _, c := range cmds { testArgs := append([]string{"-n"}, c.Args[1:]...) test := exec.Command("sudo", testArgs...) diff --git a/pkg/minikube/logs/logs.go b/pkg/minikube/logs/logs.go index 98db0334e4..acaf3f3c23 100644 --- a/pkg/minikube/logs/logs.go +++ b/pkg/minikube/logs/logs.go @@ -151,7 +151,7 @@ func OutputProblems(problems map[string][]string, maxLines int) { lines = lines[len(lines)-maxLines:] } for _, l := range lines { - out.Step(style.LogEntry, l, false) + out.Step(style.LogEntry, false, l) } } } @@ -170,9 +170,9 @@ func Output(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.Cluster failed := []string{} for i, name := range names { if i > 0 { - out.Step(style.Empty, "", false) + out.Step(style.Empty, false, "") } - out.Step(style.Empty, "==> {{.name}} <==", false, out.V{"name": name}) + out.Step(style.Empty, false, "==> {{.name}} <==", out.V{"name": name}) var b bytes.Buffer c := exec.Command("/bin/bash", "-c", cmds[name]) c.Stdout = &b @@ -184,7 +184,7 @@ func Output(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.Cluster } scanner := bufio.NewScanner(&b) for scanner.Scan() { - out.Step(style.Empty, scanner.Text(), false) + out.Step(style.Empty, false, scanner.Text()) } } diff --git a/pkg/minikube/machine/advice.go b/pkg/minikube/machine/advice.go index 60b0e4b9c2..7a257045ab 100644 --- a/pkg/minikube/machine/advice.go +++ b/pkg/minikube/machine/advice.go @@ -38,31 +38,31 @@ func MaybeDisplayAdvice(err error, driver string) { } if errors.Is(err, oci.ErrExitedUnexpectedly) || errors.Is(err, oci.ErrDaemonInfo) { - out.Step(style.Tip, "If you are still interested to make {{.driver_name}} driver work. The following suggestions might help you get passed this issue:", false, out.V{"driver_name": driver}) + out.Step(style.Tip, false, "If you are still interested to make {{.driver_name}} driver work. The following suggestions might help you get passed this issue:", out.V{"driver_name": driver}) if driver == oci.Docker || driver == oci.Podman { out.String("\n\t", false) - out.Step(style.Empty, `- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers. + out.Step(style.Empty, false, `- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers. - {{.driver_name}} system prune --volumes`, false, out.V{"driver_name": driver}) + {{.driver_name}} system prune --volumes`, out.V{"driver_name": driver}) } out.String("\n\t", false) - out.Step(style.Empty, `- Restart your {{.driver_name}} service`, false, out.V{"driver_name": driver}) + out.Step(style.Empty, false, `- Restart your {{.driver_name}} service`, out.V{"driver_name": driver}) if runtime.GOOS != "linux" { out.String("\n\t", false) - out.Step(style.Empty, `- Ensure your {{.driver_name}} daemon has access to enough CPU/memory resources.`, false, out.V{"driver_name": driver}) + out.Step(style.Empty, false, `- Ensure your {{.driver_name}} daemon has access to enough CPU/memory resources.`, out.V{"driver_name": driver}) if runtime.GOOS == "darwin" && driver == oci.Docker { out.String("\n\t", false) - out.Step(style.Empty, `- Docs https://docs.docker.com/docker-for-mac/#resources`, false, out.V{"driver_name": driver}) + out.Step(style.Empty, false, `- Docs https://docs.docker.com/docker-for-mac/#resources`, out.V{"driver_name": driver}) } if runtime.GOOS == "windows" && driver == oci.Docker { out.String("\n\t", false) - out.Step(style.Empty, `- Docs https://docs.docker.com/docker-for-windows/#resources`, false, out.V{"driver_name": driver}) + out.Step(style.Empty, false, `- Docs https://docs.docker.com/docker-for-windows/#resources`, out.V{"driver_name": driver}) } } out.String("\n\t", false) - out.Step(style.Empty, `- Delete and recreate minikube cluster + out.Step(style.Empty, false, `- Delete and recreate minikube cluster minikube delete - minikube start --driver={{.driver_name}}`, false, out.V{"driver_name": driver}) + minikube start --driver={{.driver_name}}`, out.V{"driver_name": driver}) // TODO #8348: maybe advice user if to set the --force-systemd https://github.com/kubernetes/minikube/issues/8348 } } diff --git a/pkg/minikube/machine/delete.go b/pkg/minikube/machine/delete.go index a0d629cd14..1a9ed97717 100644 --- a/pkg/minikube/machine/delete.go +++ b/pkg/minikube/machine/delete.go @@ -96,7 +96,7 @@ func DeleteHost(api libmachine.API, machineName string, deleteAbandoned ...bool) time.Sleep(1 * time.Second) } - out.Step(style.DeletingHost, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, false, out.V{"profile_name": machineName, "driver_name": host.DriverName}) + out.Step(style.DeletingHost, false, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, out.V{"profile_name": machineName, "driver_name": host.DriverName}) return delete(api, host, machineName) } diff --git a/pkg/minikube/machine/fix.go b/pkg/minikube/machine/fix.go index 668ffe26ce..7cbccbc887 100644 --- a/pkg/minikube/machine/fix.go +++ b/pkg/minikube/machine/fix.go @@ -113,7 +113,7 @@ func recreateIfNeeded(api libmachine.API, cc *config.ClusterConfig, n *config.No } if !me || err == constants.ErrMachineMissing { - out.Step(style.Shrug, `{{.driver_name}} "{{.cluster}}" {{.machine_type}} is missing, will recreate.`, false, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + out.Step(style.Shrug, false, `{{.driver_name}} "{{.cluster}}" {{.machine_type}} is missing, will recreate.`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) demolish(api, *cc, *n, h) klog.Infof("Sleeping 1 second for extra luck!") @@ -135,13 +135,13 @@ func recreateIfNeeded(api libmachine.API, cc *config.ClusterConfig, n *config.No if s == state.Running { if !recreated { - out.Step(style.Running, `Updating the running {{.driver_name}} "{{.cluster}}" {{.machine_type}} ...`, false, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + out.Step(style.Running, false, `Updating the running {{.driver_name}} "{{.cluster}}" {{.machine_type}} ...`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) } return h, nil } if !recreated { - out.Step(style.Restarting, `Restarting existing {{.driver_name}} {{.machine_type}} for "{{.cluster}}" ...`, false, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + out.Step(style.Restarting, false,`Restarting existing {{.driver_name}} {{.machine_type}} for "{{.cluster}}" ...`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) } if err := h.Driver.Start(); err != nil { MaybeDisplayAdvice(err, h.DriverName) @@ -161,7 +161,7 @@ func maybeWarnAboutEvalEnv(drver string, name string) { return } if os.Getenv(constants.MinikubeActiveDockerdEnv) != "" { - out.Step(style.Notice, "Noticed you have an activated docker-env on {{.driver_name}} driver in this terminal:", false, out.V{"driver_name": drver}) + out.Step(style.Notice, false, "Noticed you have an activated docker-env on {{.driver_name}} driver in this terminal:", out.V{"driver_name": drver}) // TODO: refactor docker-env package to generate only eval command per shell. https://github.com/kubernetes/minikube/issues/6887 out.WarningT(`Please re-eval your docker-env, To ensure your environment variables have updated ports: @@ -170,7 +170,7 @@ func maybeWarnAboutEvalEnv(drver string, name string) { `, out.V{"profile_name": name}) } if os.Getenv(constants.MinikubeActivePodmanEnv) != "" { - out.Step(style.Notice, "Noticed you have an activated podman-env on {{.driver_name}} driver in this terminal:", false, out.V{"driver_name": drver}) + out.Step(style.Notice, false, "Noticed you have an activated podman-env on {{.driver_name}} driver in this terminal:", out.V{"driver_name": drver}) // TODO: refactor podman-env package to generate only eval command per shell. https://github.com/kubernetes/minikube/issues/6887 out.WarningT(`Please re-eval your podman-env, To ensure your environment variables have updated ports: diff --git a/pkg/minikube/machine/info.go b/pkg/minikube/machine/info.go index 7d8c748226..89796ee41a 100644 --- a/pkg/minikube/machine/info.go +++ b/pkg/minikube/machine/info.go @@ -78,7 +78,7 @@ func showLocalOsRelease() { } register.Reg.SetStep(register.LocalOSRelease) - out.Step(style.Provisioner, "OS release is {{.pretty_name}}", false, out.V{"pretty_name": osReleaseInfo.PrettyName}) + out.Step(style.Provisioner, false, "OS release is {{.pretty_name}}", out.V{"pretty_name": osReleaseInfo.PrettyName}) } // logRemoteOsRelease shows systemd information about the current linux distribution, on the remote VM diff --git a/pkg/minikube/machine/start.go b/pkg/minikube/machine/start.go index 0d1316e130..7843fc84ab 100644 --- a/pkg/minikube/machine/start.go +++ b/pkg/minikube/machine/start.go @@ -327,17 +327,17 @@ func showHostInfo(cfg config.ClusterConfig) { info, cpuErr, memErr, DiskErr := CachedHostInfo() if cpuErr == nil && memErr == nil && DiskErr == nil { register.Reg.SetStep(register.RunningLocalhost) - out.Step(style.StartingNone, "Running on localhost (CPUs={{.number_of_cpus}}, Memory={{.memory_size}}MB, Disk={{.disk_size}}MB) ...", false, out.V{"number_of_cpus": info.CPUs, "memory_size": info.Memory, "disk_size": info.DiskSize}) + out.Step(style.StartingNone, false, "Running on localhost (CPUs={{.number_of_cpus}}, Memory={{.memory_size}}MB, Disk={{.disk_size}}MB) ...", out.V{"number_of_cpus": info.CPUs, "memory_size": info.Memory, "disk_size": info.DiskSize}) } return } if driver.IsKIC(cfg.Driver) { // TODO:medyagh add free disk space on docker machine register.Reg.SetStep(register.CreatingContainer) - out.Step(style.StartingVM, "Creating {{.driver_name}} {{.machine_type}} (CPUs={{.number_of_cpus}}, Memory={{.memory_size}}MB) ...", false, out.V{"driver_name": cfg.Driver, "number_of_cpus": cfg.CPUs, "memory_size": cfg.Memory, "machine_type": machineType}) + out.Step(style.StartingVM, false, "Creating {{.driver_name}} {{.machine_type}} (CPUs={{.number_of_cpus}}, Memory={{.memory_size}}MB) ...", out.V{"driver_name": cfg.Driver, "number_of_cpus": cfg.CPUs, "memory_size": cfg.Memory, "machine_type": machineType}) return } register.Reg.SetStep(register.CreatingVM) - out.Step(style.StartingVM, "Creating {{.driver_name}} {{.machine_type}} (CPUs={{.number_of_cpus}}, Memory={{.memory_size}}MB, Disk={{.disk_size}}MB) ...", false, out.V{"driver_name": cfg.Driver, "number_of_cpus": cfg.CPUs, "memory_size": cfg.Memory, "disk_size": cfg.DiskSize, "machine_type": machineType}) + out.Step(style.StartingVM, false, "Creating {{.driver_name}} {{.machine_type}} (CPUs={{.number_of_cpus}}, Memory={{.memory_size}}MB, Disk={{.disk_size}}MB) ...", out.V{"driver_name": cfg.Driver, "number_of_cpus": cfg.CPUs, "memory_size": cfg.Memory, "disk_size": cfg.DiskSize, "machine_type": machineType}) } // AddHostAlias makes fine adjustments to pod resources that aren't possible via kubeadm config. diff --git a/pkg/minikube/machine/stop.go b/pkg/minikube/machine/stop.go index 58fa10c6e1..75cb062c98 100644 --- a/pkg/minikube/machine/stop.go +++ b/pkg/minikube/machine/stop.go @@ -42,7 +42,7 @@ func StopHost(api libmachine.API, machineName string) error { return errors.Wrapf(err, "load") } - out.Step(style.Stopping, `Stopping node "{{.name}}" ...`, false, out.V{"name": machineName}) + out.Step(style.Stopping, false, `Stopping node "{{.name}}" ...`, out.V{"name": machineName}) return stop(h) } @@ -81,7 +81,7 @@ func trySSHPowerOff(h *host.Host) error { } register.Reg.SetStep(register.PowerOff) - out.Step(style.Shutdown, `Powering off "{{.profile_name}}" via SSH ...`, false, out.V{"profile_name": h.Name}) + out.Step(style.Shutdown, false, `Powering off "{{.profile_name}}" via SSH ...`, out.V{"profile_name": h.Name}) // differnet for kic because RunSSHCommand is not implemented by kic if driver.IsKIC(h.DriverName) { err := oci.ShutDown(h.DriverName, h.Name) diff --git a/pkg/minikube/mustload/mustload.go b/pkg/minikube/mustload/mustload.go index 251c267200..f6ee7070ad 100644 --- a/pkg/minikube/mustload/mustload.go +++ b/pkg/minikube/mustload/mustload.go @@ -72,7 +72,7 @@ func Partial(name string, miniHome ...string) (libmachine.API, *config.ClusterCo cc, err := config.Load(name, miniHome...) if err != nil { if config.IsNotExist(err) { - out.Step(style.Shrug, `Profile "{{.cluster}}" not found. Run "minikube profile list" to view all profiles.`, false, out.V{"cluster": name}) + out.Step(style.Shrug, false, `Profile "{{.cluster}}" not found. Run "minikube profile list" to view all profiles.`, out.V{"cluster": name}) exitTip("start", name, reason.ExGuestNotFound) } exit.Error(reason.HostConfigLoad, "Error getting cluster config", err) @@ -97,17 +97,17 @@ func Running(name string) ClusterController { } if hs == state.None.String() { - out.Step(style.Shrug, `The control plane node "{{.name}}" does not exist.`, false, out.V{"name": cp.Name}) + out.Step(style.Shrug, false, `The control plane node "{{.name}}" does not exist.`, out.V{"name": cp.Name}) exitTip("start", name, reason.ExGuestNotFound) } if hs == state.Stopped.String() { - out.Step(style.Shrug, `The control plane node must be running for this command`, false) + out.Step(style.Shrug, false, `The control plane node must be running for this command`) exitTip("start", name, reason.ExGuestUnavailable) } if hs != state.Running.String() { - out.Step(style.Shrug, `The control plane node is not running (state={{.state}})`, false, out.V{"name": cp.Name, "state": hs}) + out.Step(style.Shrug, false, `The control plane node is not running (state={{.state}})`, out.V{"name": cp.Name, "state": hs}) exitTip("start", name, reason.ExSvcUnavailable) } @@ -151,12 +151,12 @@ func Healthy(name string) ClusterController { } if as == state.Paused { - out.Step(style.Shrug, `The control plane for "{{.name}}" is paused!`, false, out.V{"name": name}) + out.Step(style.Shrug, false, `The control plane for "{{.name}}" is paused!`, out.V{"name": name}) exitTip("unpause", name, reason.ExSvcConfig) } if as != state.Running { - out.Step(style.Shrug, `This control plane is not running! (state={{.state}})`, false, out.V{"state": as.String()}) + out.Step(style.Shrug, false, `This control plane is not running! (state={{.state}})`, out.V{"state": as.String()}) out.WarningT(`This is unusual - you may want to investigate using "{{.command}}"`, out.V{"command": ExampleCmd(name, "logs")}) exitTip("start", name, reason.ExSvcUnavailable) } @@ -174,6 +174,6 @@ func ExampleCmd(cname string, action string) string { // exitTip returns an action tip and exits func exitTip(action string, profile string, code int) { command := ExampleCmd(profile, action) - out.Step(style.Workaround, `To start a cluster, run: "{{.command}}"`, false, out.V{"command": command}) + out.Step(style.Workaround, false, `To start a cluster, run: "{{.command}}"`, out.V{"command": command}) os.Exit(code) } diff --git a/pkg/minikube/node/cache.go b/pkg/minikube/node/cache.go index 5b4c97feb0..bc9c3df668 100644 --- a/pkg/minikube/node/cache.go +++ b/pkg/minikube/node/cache.go @@ -86,7 +86,7 @@ func handleDownloadOnly(cacheGroup, kicGroup *errgroup.Group, k8sVersion string) if err := saveImagesToTarFromConfig(); err != nil { exit.Error(reason.InetCacheTar, "Failed to cache images to tar", err) } - out.Step(style.Check, "Download complete!", false) + out.Step(style.Check, false, "Download complete!") os.Exit(0) } @@ -119,7 +119,7 @@ func beginDownloadKicBaseImage(g *errgroup.Group, cc *config.ClusterConfig, down klog.Infof("Beginning downloading kic base image for %s with %s", cc.Driver, cc.KubernetesConfig.ContainerRuntime) register.Reg.SetStep(register.PullingBaseImage) - out.Step(style.Pulling, "Pulling base image ...", false) + out.Step(style.Pulling, false, "Pulling base image ...") g.Go(func() error { baseImg := cc.KicBaseImage if baseImg == kic.BaseImage && len(cc.KubernetesConfig.ImageRepository) != 0 { @@ -169,9 +169,9 @@ func waitDownloadKicBaseImage(g *errgroup.Group) { klog.Warningf("Error downloading kic artifacts: %v", err) out.ErrT(style.Connectivity, "Unfortunately, could not download the base image {{.image_name}} ", out.V{"image_name": strings.Split(kic.BaseImage, "@")[0]}) out.WarningT("In order to use the fall back image, you need to log in to the github packages registry") - out.Step(style.Documentation, `Please visit the following link for documentation around this: + out.Step(style.Documentation, false, `Please visit the following link for documentation around this: https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-to-github-packages -`, false) +`) } if errors.Is(err, image.ErrGithubNeedsLogin) || errors.Is(err, image.ErrNeedsLogin) { exit.Message(reason.Usage, `Please either authenticate to the registry or use --base-image flag to use a different registry.`) diff --git a/pkg/minikube/node/config.go b/pkg/minikube/node/config.go index 3ebc2e5658..8e4013e9af 100644 --- a/pkg/minikube/node/config.go +++ b/pkg/minikube/node/config.go @@ -41,7 +41,7 @@ import ( func showVersionInfo(k8sVersion string, cr cruntime.Manager) { version, _ := cr.Version() register.Reg.SetStep(register.PreparingKubernetes) - out.Step(cr.Style(), "Preparing Kubernetes {{.k8sVersion}} on {{.runtime}} {{.runtimeVersion}} ...", true, out.V{"k8sVersion": k8sVersion, "runtime": cr.Name(), "runtimeVersion": version}) + out.Step(cr.Style(), true,"Preparing Kubernetes {{.k8sVersion}} on {{.runtime}} {{.runtimeVersion}} ...", out.V{"k8sVersion": k8sVersion, "runtime": cr.Name(), "runtimeVersion": version}) for _, v := range config.DockerOpt { out.Infof("opt {{.docker_option}}", out.V{"docker_option": v}) } @@ -59,7 +59,7 @@ func configureMounts(wg *sync.WaitGroup) { return } - out.Step(style.Mounting, "Creating mount {{.name}} ...", false, out.V{"name": viper.GetString(mountString)}) + out.Step(style.Mounting, false, "Creating mount {{.name}} ...", out.V{"name": viper.GetString(mountString)}) path := os.Args[0] mountDebugVal := 0 if klog.V(8).Enabled() { diff --git a/pkg/minikube/node/start.go b/pkg/minikube/node/start.go index 6ae372cea3..002c1fbe5c 100644 --- a/pkg/minikube/node/start.go +++ b/pkg/minikube/node/start.go @@ -212,9 +212,9 @@ func Provision(cc *config.ClusterConfig, n *config.Node, apiServer bool, delOnFa register.Reg.SetStep(register.StartingNode) name := driver.MachineName(*cc, *n) if apiServer { - out.Step(style.ThumbsUp, "Starting control plane node {{.name}} in cluster {{.cluster}}", false, out.V{"name": name, "cluster": cc.Name}) + out.Step(style.ThumbsUp, false, "Starting control plane node {{.name}} in cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name}) } else { - out.Step(style.ThumbsUp, "Starting node {{.name}} in cluster {{.cluster}}", false, out.V{"name": name, "cluster": cc.Name}) + out.Step(style.ThumbsUp, false, "Starting node {{.name}} in cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name}) } if driver.IsKIC(cc.Driver) { @@ -425,7 +425,7 @@ func validateNetwork(h *host.Host, r command.Runner, imageRepository string) (st for _, k := range proxy.EnvVars { if v := os.Getenv(k); v != "" { if !optSeen { - out.Step(style.Internet, "Found network options:", false) + out.Step(style.Internet, false, "Found network options:") optSeen = true } out.Infof("{{.key}}={{.value}}", out.V{"key": k, "value": v}) @@ -433,7 +433,7 @@ func validateNetwork(h *host.Host, r command.Runner, imageRepository string) (st k = strings.ToUpper(k) // for http_proxy & https_proxy if (k == "HTTP_PROXY" || k == "HTTPS_PROXY") && !ipExcluded && !warnedOnce { out.WarningT("You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP ({{.ip_address}}).", out.V{"ip_address": ip}) - out.Step(style.Documentation, "Please see {{.documentation_url}} for more details", false, out.V{"documentation_url": "https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/"}) + out.Step(style.Documentation, false, "Please see {{.documentation_url}} for more details", out.V{"documentation_url": "https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/"}) warnedOnce = true } } @@ -515,7 +515,7 @@ func tryRegistry(r command.Runner, driverName string, imageRepository string) { // prepareNone prepares the user and host for the joy of the "none" driver func prepareNone() { register.Reg.SetStep(register.ConfiguringLHEnv) - out.Step(style.StartingNone, "Configuring local host environment ...", false) + out.Step(style.StartingNone, false, "Configuring local host environment ...") if viper.GetBool(config.WantNoneDriverWarning) { out.ErrT(style.Empty, "") out.WarningT("The 'none' driver is designed for experts who need to integrate with an existing VM") diff --git a/pkg/minikube/notify/notify.go b/pkg/minikube/notify/notify.go index db2db12ef4..a7903ba4ce 100644 --- a/pkg/minikube/notify/notify.go +++ b/pkg/minikube/notify/notify.go @@ -67,8 +67,8 @@ func MaybePrintUpdateText(url string, lastUpdatePath string) bool { klog.Errorf("write time failed: %v", err) } url := "https://github.com/kubernetes/minikube/releases/tag/v" + latestVersion.String() - out.Step(style.Celebrate, `minikube {{.version}} is available! Download it: {{.url}}`, false, out.V{"version": latestVersion, "url": url}) - out.Step(style.Tip, "To disable this notice, run: 'minikube config set WantUpdateNotification false'\n", false) + out.Step(style.Celebrate, false, `minikube {{.version}} is available! Download it: {{.url}}`, out.V{"version": latestVersion, "url": url}) + out.Step(style.Tip, false, "To disable this notice, run: 'minikube config set WantUpdateNotification false'\n") return true } return false diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go index 516d0f7c37..3350c7db91 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -77,7 +77,7 @@ type fdWriter interface { type V map[string]interface{} // Step writes a stylized and templated message to stdout -func Step(st style.Enum, format string, spinner bool, a ...V) { +func Step(st style.Enum, spinner bool, format string, a ...V) { if st == style.Option { Infof(format, a...) return @@ -168,7 +168,7 @@ func ErrLn(format string, a ...interface{}) { // SuccessT is a shortcut for writing a templated success message to stdout func SuccessT(format string, a ...V) { - Step(style.Success, format, false, a...) + Step(style.Success, false, format, a...) } // FatalT is a shortcut for writing a templated fatal message to stderr @@ -253,12 +253,12 @@ func LogEntries(msg string, err error, entries map[string][]string) { DisplayError(msg, err) for name, lines := range entries { - Step(style.Failure, "Problems detected in {{.entry}}:", false, V{"entry": name}) + Step(style.Failure, false, "Problems detected in {{.entry}}:", V{"entry": name}) if len(lines) > MaxLogEntries { lines = lines[:MaxLogEntries] } for _, l := range lines { - Step(style.LogEntry, l, false) + Step(style.LogEntry, false, l) } } } diff --git a/pkg/minikube/service/service.go b/pkg/minikube/service/service.go index 1b08c05872..bbe1fdd259 100644 --- a/pkg/minikube/service/service.go +++ b/pkg/minikube/service/service.go @@ -287,7 +287,7 @@ func WaitForService(api libmachine.API, cname string, namespace string, service } if len(serviceURL.URLs) == 0 { - out.Step(style.Sad, "service {{.namespace_name}}/{{.service_name}} has no node port", false, out.V{"namespace_name": namespace, "service_name": service}) + out.Step(style.Sad, false, "service {{.namespace_name}}/{{.service_name}} has no node port", out.V{"namespace_name": namespace, "service_name": service}) return urlList, nil } diff --git a/pkg/minikube/tunnel/kic/ssh_conn.go b/pkg/minikube/tunnel/kic/ssh_conn.go index 5f31eafb3b..55f7413d34 100644 --- a/pkg/minikube/tunnel/kic/ssh_conn.go +++ b/pkg/minikube/tunnel/kic/ssh_conn.go @@ -69,13 +69,12 @@ func createSSHConn(name, sshPort, sshKey string, svc *v1.Service) *sshConn { if askForSudo { out.Step( - style.Warning, + style.Warning, false, "The service {{.service}} requires privileged ports to be exposed: {{.ports}}", - false, out.V{"service": svc.Name, "ports": fmt.Sprintf("%v", privilegedPorts)}, ) - out.Step(style.Permissions, "sudo permission will be asked for it.", false) + out.Step(style.Permissions, false, "sudo permission will be asked for it.") command = "sudo" sshArgs = append([]string{"ssh"}, sshArgs...) @@ -132,7 +131,7 @@ func createSSHConnWithRandomPorts(name, sshPort, sshKey string, svc *v1.Service) } func (c *sshConn) startAndWait() error { - out.Step(style.Running, "Starting tunnel for service {{.service}}.", false, out.V{"service": c.service}) + out.Step(style.Running, false, "Starting tunnel for service {{.service}}.", out.V{"service": c.service}) err := c.cmd.Start() if err != nil { @@ -146,7 +145,7 @@ func (c *sshConn) startAndWait() error { } func (c *sshConn) stop() error { - out.Step(style.Stopping, "Stopping tunnel for service {{.service}}.", false, out.V{"service": c.service}) + out.Step(style.Stopping, false, "Stopping tunnel for service {{.service}}.", out.V{"service": c.service}) return c.cmd.Process.Kill() }