From df37c7824b97361f7a68d87b5ae22f448e9d54db Mon Sep 17 00:00:00 2001 From: alonyb Date: Wed, 2 Dec 2020 01:17:19 -0500 Subject: [PATCH 01/30] change config func call --- pkg/minikube/node/config.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/minikube/node/config.go b/pkg/minikube/node/config.go index 5d3d926e7393..a967370b52b8 100644 --- a/pkg/minikube/node/config.go +++ b/pkg/minikube/node/config.go @@ -18,12 +18,6 @@ package node import ( "fmt" - "os" - "os/exec" - "path/filepath" - "strconv" - "sync" - "github.com/spf13/viper" "k8s.io/klog/v2" "k8s.io/minikube/pkg/minikube/config" @@ -36,12 +30,17 @@ import ( "k8s.io/minikube/pkg/minikube/reason" "k8s.io/minikube/pkg/minikube/style" "k8s.io/minikube/pkg/util/lock" + "os" + "os/exec" + "path/filepath" + "strconv" + "sync" ) 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}} ...", out.V{"k8sVersion": k8sVersion, "runtime": cr.Name(), "runtimeVersion": version}) + out.SpinnerStep(cr.Style(), "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}) } From 2e3e0ab7519b92be23436042f54a5c10cf31c617 Mon Sep 17 00:00:00 2001 From: alonyb Date: Wed, 2 Dec 2020 01:18:49 -0500 Subject: [PATCH 02/30] add new method to print spinner --- pkg/minikube/out/out.go | 43 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go index 9f71859c2531..a10b15ab0c24 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -20,14 +20,15 @@ package out import ( "bytes" "fmt" + "github.com/briandowns/spinner" + isatty "github.com/mattn/go-isatty" "html" "html/template" "io" "os" "strconv" "strings" - - isatty "github.com/mattn/go-isatty" + "time" "k8s.io/klog/v2" "k8s.io/minikube/pkg/minikube/out/register" @@ -58,6 +59,8 @@ var ( OverrideEnv = "MINIKUBE_IN_STYLE" // JSON is whether or not we should output stdout in JSON format. Set using SetJSON() JSON = false + // spin is spinner showed at starting minikube + spin = spinner.New(spinner.CharSets[9], 100*time.Millisecond) ) // MaxLogEntries controls the number of log entries to show for each source @@ -87,6 +90,21 @@ func Step(st style.Enum, format string, a ...V) { String(outStyled) } +// Step writes a stylized and templated message to stdout +func SpinnerStep(st style.Enum, format string, a ...V) { + if st == style.Option { + Infof(format, a...) + return + } + outStyled := spinnerStylized(st, useColor, format, a...) + if JSON { + register.PrintStep(outStyled) + return + } + register.RecordStep(outStyled) + SpinnerString(outStyled) +} + // Infof is used for informational logs (options, env variables, etc) func Infof(format string, a ...V) { outStyled := stylized(style.Option, useColor, format, a...) @@ -108,11 +126,32 @@ func String(format string, a ...interface{}) { } klog.Infof(format, a...) + if spin.Active() == true { + spin.Stop() + } + _, err := fmt.Fprintf(outFile, format, a...) + if err != nil { + klog.Errorf("Fprintf failed: %v", err) + } +} + +// SpinnerString writes a basic formatted string and spinner to stdout +func SpinnerString(format string, a ...interface{}) { + // Flush log buffer so that output order makes sense + klog.Flush() + if outFile == nil { + klog.Warningf("[unset outFile]: %s", fmt.Sprintf(format, a...)) + return + } + + klog.Infof(format, a...) _, err := fmt.Fprintf(outFile, format, a...) if err != nil { klog.Errorf("Fprintf failed: %v", err) } + spin.Start() + } // Ln writes a basic formatted string with a newline to stdout From 7a0a2b006336a2472635f13f12adff89ed17627c Mon Sep 17 00:00:00 2001 From: alonyb Date: Wed, 2 Dec 2020 01:23:46 -0500 Subject: [PATCH 03/30] remove break line in spinner line --- pkg/minikube/out/out_style.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/minikube/out/out_style.go b/pkg/minikube/out/out_style.go index 33260e179868..2fffa6cf98ef 100644 --- a/pkg/minikube/out/out_style.go +++ b/pkg/minikube/out/out_style.go @@ -31,11 +31,11 @@ func applyPrefix(prefix, format string) string { } // applyStyle translates the given string if necessary then adds any appropriate style prefix. -func applyStyle(st style.Enum, useColor bool, format string) string { +func applyStyle(st style.Enum, useColor bool, format string, spinner bool) string { format = translate.T(format) s, ok := style.Config[st] - if !s.OmitNewline { + if !s.OmitNewline && !spinner { format += "\n" } @@ -55,6 +55,15 @@ func stylized(st style.Enum, useColor bool, format string, a ...V) string { if a == nil { a = []V{{}} } - format = applyStyle(st, useColor, format) + format = applyStyle(st, useColor, format, false) + return Fmt(format, a...) +} + +// spinnerStylized applies formatting to the provided template +func spinnerStylized(st style.Enum, useColor bool, format string, a ...V) string { + if a == nil { + a = []V{{}} + } + format = applyStyle(st, useColor, format, true) return Fmt(format, a...) } From 65dc5b807946bef6e539f85efa45e936142fe091 Mon Sep 17 00:00:00 2001 From: alonyb Date: Wed, 2 Dec 2020 01:24:41 -0500 Subject: [PATCH 04/30] add spinner library to mod --- go.mod | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index b3c9278dee72..4050c72c71d8 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect github.com/VividCortex/godaemon v0.0.0-20201030160542-15e3f4925a21 github.com/blang/semver v3.5.0+incompatible + github.com/briandowns/spinner v1.11.1 github.com/c4milo/gotoolkit v0.0.0-20170318115440-bcc06269efa9 // indirect github.com/cenkalti/backoff v2.2.1+incompatible github.com/cenkalti/backoff/v4 v4.1.0 @@ -75,7 +76,6 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f github.com/zchee/go-vmnet v0.0.0-20161021174912-97ebf9174097 - go.opencensus.io v0.22.4 go.opentelemetry.io/otel v0.13.0 go.opentelemetry.io/otel/sdk v0.13.0 golang.org/x/build v0.0.0-20190927031335-2835ba2e683f @@ -103,6 +103,7 @@ require ( replace ( git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999 + github.com/briandowns/spinner => github.com/alonyb/spinner v1.12.0 github.com/docker/docker => github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7 github.com/docker/machine => github.com/machine-drivers/machine v0.7.1-0.20200810185219-7d42fed1b770 github.com/google/go-containerregistry => github.com/afbjorklund/go-containerregistry v0.0.0-20200902152226-fbad78ec2813 From 88947d6e0fb589d7c0414dd8413f762ed679dd17 Mon Sep 17 00:00:00 2001 From: alonyb Date: Fri, 4 Dec 2020 06:26:29 -0500 Subject: [PATCH 05/30] add break line in windows case --- go.sum | 27 +++++++++++++++++++++++++-- pkg/minikube/out/out.go | 4 ++++ start.sh | 4 ++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 start.sh diff --git a/go.sum b/go.sum index a0046dc65280..d9ff63926da5 100644 --- a/go.sum +++ b/go.sum @@ -93,7 +93,6 @@ github.com/Djarvur/go-err113 v0.0.0-20200410182137-af658d038157/go.mod h1:4UJr5H github.com/Djarvur/go-err113 v0.1.0/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20191009163259-e802c2cb94ae/go.mod h1:mjwGPas4yKduTyubHvD1Atl9r1rUq8DfVy+gkVvZ+oo= github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20190822182118-27a4ced34534/go.mod h1:iroGtC8B3tQiqtds1l+mgk/BBOrxbqjH+eUfFQYRc14= -github.com/GoogleCloudPlatform/opentelemetry-operations-go v0.13.0 h1:Gx9IxOjR9ug5Ad8YbafxJ6N2g6oDj/Q419tYHdd1od4= github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v0.13.0 h1:fjKUtfldCPIF4nIzAAj3LzP8Lrd3DuRIMiFdOsj4fLc= github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v0.13.0/go.mod h1:q/paYxLXKVhwfC3lzLfhtL54fAx14wzMN9DundQOBMc= github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab/go.mod h1:3VYc5hodBMJ5+l/7J4xAyMeuM2PNuepvHlGs8yilUCA= @@ -143,6 +142,26 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZq github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alonyb/spinner v1.11.1/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/alonyb/spinner v1.11.2-0.20201202060434-7fc79151c299/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/alonyb/spinner v1.11.2 h1:VbYxuLi6XOXUE+ytgPkYXP1NBwCUm4bC03mduxaIY0U= +github.com/alonyb/spinner v1.11.2/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/alonyb/spinner v1.11.3 h1:FmbXovsaoSRb/eZ+0sgOzZsEWyoV8OrAZ9ciwXO+hDM= +github.com/alonyb/spinner v1.11.3/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/alonyb/spinner v1.11.4 h1:TCfdsdmtbVtAY8lQ8B/p/G+ZWjdsj7MtGW60weyGD0s= +github.com/alonyb/spinner v1.11.4/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/alonyb/spinner v1.11.5 h1:lTY/BLIkEil313zuUXmyNicQe29BFf2N1+VmJP4sGAE= +github.com/alonyb/spinner v1.11.5/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/alonyb/spinner v1.11.6 h1:aKYqa5BPfKnkAaY0Tfo7vWhJYQkNcJdBgn8BbuHltb8= +github.com/alonyb/spinner v1.11.6/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/alonyb/spinner v1.11.7 h1:3GN8d/o6GJIdaoZFLSyReJbSVr9PEdGazAGBDTXwhl4= +github.com/alonyb/spinner v1.11.7/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/alonyb/spinner v1.11.8 h1:Tk1M6yXz7NwgXqIHM0/vVWO57lhpinGetrQl2oD9btg= +github.com/alonyb/spinner v1.11.8/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/alonyb/spinner v1.11.9 h1:lUn+9oo7sWkePQvbNh4fI5lBg84ZgMNtoFbnwMiXiIY= +github.com/alonyb/spinner v1.11.9/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/alonyb/spinner v1.12.0 h1:QJ+n3tR1fR+e+0gTZE7s/GsOS8rDRtCJkehtlWxFaxs= +github.com/alonyb/spinner v1.12.0/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/apex/log v1.1.4/go.mod h1:AlpoD9aScyQfJDVHmLMEcx4oU6LqzkWp4Mg9GdAcEvQ= @@ -555,6 +574,7 @@ github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPg github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible h1:xmapqc1AyLoB+ddYT6r04bD9lIjlOqGaREovi0SzFaE= github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0 h1:pMen7vLs8nvgEYhywH3KDWJIJTeEr2ULsVWHWYHQyBs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f h1:Jnx61latede7zDD3DiiP4gmNz33uK0U5HDUaF0a/HVQ= @@ -585,6 +605,7 @@ github.com/googleapis/gnostic v0.1.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTV github.com/googleapis/gnostic v0.2.2/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.3.0 h1:CcQijm0XKekKjP/YCz28LXVSpgguuB+nCxaSjCe09y0= github.com/googleapis/gnostic v0.3.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/googleinterns/cloud-operations-api-mock v0.0.0-20200709193332-a1e58c29bdd3 h1:eHv/jVY/JNop1xg2J9cBb4EzyMpWZoNCP1BslSAIkOI= github.com/googleinterns/cloud-operations-api-mock v0.0.0-20200709193332-a1e58c29bdd3/go.mod h1:h/KNeRx7oYU4SpA4SoY7W2/NxDKEEVuwA6j9A27L4OI= github.com/gookit/color v1.2.4/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= @@ -1105,6 +1126,7 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= @@ -1190,7 +1212,6 @@ go.opencensus.io v0.22.3 h1:8sGtKOrtQqkN1bp2AtX+misvLIlOmsEsNd+9NIcPEm8= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4 h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io v0.1.0 h1:EANZoRCOP+A3faIlw/iN6YEWoYb1vleZRKm1EvH8T48= go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= @@ -1503,6 +1524,7 @@ golang.org/x/tools v0.0.0-20200527183253-8e7acdbce89d h1:SR+e35rACZFBohNb4Om1ibX golang.org/x/tools v0.0.0-20200527183253-8e7acdbce89d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200701151220-7cb253f4c4f8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed h1:+qzWo37K31KxduIYaBeMqJ8MUOyTayOQKpH9aDPLMSY= golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= @@ -1661,6 +1683,7 @@ gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.1.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go index a10b15ab0c24..b518033553f8 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -26,6 +26,7 @@ import ( "html/template" "io" "os" + "runtime" "strconv" "strings" "time" @@ -128,6 +129,9 @@ func String(format string, a ...interface{}) { klog.Infof(format, a...) if spin.Active() == true { spin.Stop() + if runtime.GOOS == "windows" { + fmt.Print("\n") + } } _, err := fmt.Fprintf(outFile, format, a...) if err != nil { diff --git a/start.sh b/start.sh new file mode 100644 index 000000000000..a4ea03d06b29 --- /dev/null +++ b/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash +./out/minikube delete +rm ./out/minikube +make && ./out/minikube start From ead02fde4e0188f98f2f890b236fb08acb538610 Mon Sep 17 00:00:00 2001 From: alonyb Date: Fri, 4 Dec 2020 06:28:26 -0500 Subject: [PATCH 06/30] remove unnecesary file --- start.sh | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 start.sh diff --git a/start.sh b/start.sh deleted file mode 100644 index a4ea03d06b29..000000000000 --- a/start.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -./out/minikube delete -rm ./out/minikube -make && ./out/minikube start From f37a4aaa149788a8c403c4439211f7e3769a6f9b Mon Sep 17 00:00:00 2001 From: alonyb Date: Fri, 4 Dec 2020 06:32:19 -0500 Subject: [PATCH 07/30] remove windows break line --- pkg/minikube/out/out.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go index b518033553f8..63f9c993791c 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -26,7 +26,6 @@ import ( "html/template" "io" "os" - "runtime" "strconv" "strings" "time" @@ -128,10 +127,6 @@ func String(format string, a ...interface{}) { klog.Infof(format, a...) if spin.Active() == true { - spin.Stop() - if runtime.GOOS == "windows" { - fmt.Print("\n") - } } _, err := fmt.Fprintf(outFile, format, a...) if err != nil { From 6e37ffb67172ee42ca0b4c20f7a71e74b9c52d16 Mon Sep 17 00:00:00 2001 From: alonyb Date: Fri, 4 Dec 2020 11:24:21 -0500 Subject: [PATCH 08/30] change spinner module version --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 4050c72c71d8..db6549d05b2f 100644 --- a/go.mod +++ b/go.mod @@ -103,7 +103,7 @@ require ( replace ( git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999 - github.com/briandowns/spinner => github.com/alonyb/spinner v1.12.0 + github.com/briandowns/spinner => github.com/alonyb/spinner v1.12.1 github.com/docker/docker => github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7 github.com/docker/machine => github.com/machine-drivers/machine v0.7.1-0.20200810185219-7d42fed1b770 github.com/google/go-containerregistry => github.com/afbjorklund/go-containerregistry v0.0.0-20200902152226-fbad78ec2813 From 994ff36e30f1692d47315fd4c4d3807fd7ab49be Mon Sep 17 00:00:00 2001 From: alonyb Date: Fri, 4 Dec 2020 11:24:36 -0500 Subject: [PATCH 09/30] restore break line --- pkg/minikube/out/out.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go index 63f9c993791c..a10b15ab0c24 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -127,6 +127,7 @@ func String(format string, a ...interface{}) { klog.Infof(format, a...) if spin.Active() == true { + spin.Stop() } _, err := fmt.Fprintf(outFile, format, a...) if err != nil { From b6ee8f2f6777921a87959df78e2497fafc9c5864 Mon Sep 17 00:00:00 2001 From: alonyb Date: Fri, 4 Dec 2020 12:01:49 -0500 Subject: [PATCH 10/30] remove old versions of the spinner --- go.sum | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/go.sum b/go.sum index d9ff63926da5..0ac836ad8d17 100644 --- a/go.sum +++ b/go.sum @@ -142,26 +142,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZq github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alonyb/spinner v1.11.1/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= -github.com/alonyb/spinner v1.11.2-0.20201202060434-7fc79151c299/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= -github.com/alonyb/spinner v1.11.2 h1:VbYxuLi6XOXUE+ytgPkYXP1NBwCUm4bC03mduxaIY0U= -github.com/alonyb/spinner v1.11.2/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= -github.com/alonyb/spinner v1.11.3 h1:FmbXovsaoSRb/eZ+0sgOzZsEWyoV8OrAZ9ciwXO+hDM= -github.com/alonyb/spinner v1.11.3/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= -github.com/alonyb/spinner v1.11.4 h1:TCfdsdmtbVtAY8lQ8B/p/G+ZWjdsj7MtGW60weyGD0s= -github.com/alonyb/spinner v1.11.4/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= -github.com/alonyb/spinner v1.11.5 h1:lTY/BLIkEil313zuUXmyNicQe29BFf2N1+VmJP4sGAE= -github.com/alonyb/spinner v1.11.5/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= -github.com/alonyb/spinner v1.11.6 h1:aKYqa5BPfKnkAaY0Tfo7vWhJYQkNcJdBgn8BbuHltb8= -github.com/alonyb/spinner v1.11.6/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= -github.com/alonyb/spinner v1.11.7 h1:3GN8d/o6GJIdaoZFLSyReJbSVr9PEdGazAGBDTXwhl4= -github.com/alonyb/spinner v1.11.7/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= -github.com/alonyb/spinner v1.11.8 h1:Tk1M6yXz7NwgXqIHM0/vVWO57lhpinGetrQl2oD9btg= -github.com/alonyb/spinner v1.11.8/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= -github.com/alonyb/spinner v1.11.9 h1:lUn+9oo7sWkePQvbNh4fI5lBg84ZgMNtoFbnwMiXiIY= -github.com/alonyb/spinner v1.11.9/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= -github.com/alonyb/spinner v1.12.0 h1:QJ+n3tR1fR+e+0gTZE7s/GsOS8rDRtCJkehtlWxFaxs= -github.com/alonyb/spinner v1.12.0/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= +github.com/alonyb/spinner v1.12.1 h1:zB6IQ29/kTR/NWHJhIgU2tXW+fhXa3K5zrDQMddd9H0= +github.com/alonyb/spinner v1.12.1/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/apex/log v1.1.4/go.mod h1:AlpoD9aScyQfJDVHmLMEcx4oU6LqzkWp4Mg9GdAcEvQ= From 33b6e9a70e03dc6ecd29aa97960ff45725a11b7e Mon Sep 17 00:00:00 2001 From: alonyb Date: Sun, 6 Dec 2020 21:21:25 -0500 Subject: [PATCH 11/30] add spinner param in step func --- cmd/minikube/cmd/config/addons_list.go | 4 +- cmd/minikube/cmd/config/disable.go | 2 +- cmd/minikube/cmd/config/enable.go | 6 +- cmd/minikube/cmd/config/open.go | 2 +- cmd/minikube/cmd/config/profile.go | 2 +- cmd/minikube/cmd/config/profile_list.go | 4 +- cmd/minikube/cmd/config/prompt.go | 4 +- cmd/minikube/cmd/dashboard.go | 2 +- cmd/minikube/cmd/delete.go | 20 +++---- cmd/minikube/cmd/generate-docs.go | 2 +- cmd/minikube/cmd/mount.go | 12 ++-- cmd/minikube/cmd/node_add.go | 4 +- cmd/minikube/cmd/node_delete.go | 4 +- cmd/minikube/cmd/node_start.go | 4 +- cmd/minikube/cmd/node_stop.go | 2 +- cmd/minikube/cmd/options.go | 4 +- cmd/minikube/cmd/pause.go | 6 +- cmd/minikube/cmd/service.go | 6 +- cmd/minikube/cmd/start.go | 30 +++++----- cmd/minikube/cmd/start_flags.go | 2 +- cmd/minikube/cmd/stop.go | 4 +- cmd/minikube/cmd/unpause.go | 6 +- cmd/minikube/cmd/update-context.go | 6 +- pkg/addons/addons.go | 12 ++-- pkg/addons/gcpauth/enable.go | 2 +- pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 24 ++++---- pkg/minikube/browser/browser.go | 2 +- pkg/minikube/download/driver.go | 2 +- pkg/minikube/download/iso.go | 2 +- pkg/minikube/download/preload.go | 2 +- pkg/minikube/driver/install.go | 2 +- pkg/minikube/logs/logs.go | 8 +-- pkg/minikube/machine/advice.go | 26 ++++----- pkg/minikube/machine/delete.go | 2 +- pkg/minikube/machine/fix.go | 10 ++-- pkg/minikube/machine/info.go | 2 +- pkg/minikube/machine/start.go | 6 +- pkg/minikube/machine/stop.go | 4 +- pkg/minikube/mustload/mustload.go | 14 ++--- pkg/minikube/node/cache.go | 6 +- pkg/minikube/node/config.go | 5 +- pkg/minikube/node/start.go | 10 ++-- pkg/minikube/notify/notify.go | 4 +- pkg/minikube/out/out.go | 58 +++++--------------- pkg/minikube/out/out_style.go | 15 +---- pkg/minikube/out/out_style_test.go | 4 +- pkg/minikube/out/out_test.go | 6 +- pkg/minikube/service/service.go | 2 +- pkg/minikube/tunnel/kic/ssh_conn.go | 7 ++- 49 files changed, 169 insertions(+), 206 deletions(-) diff --git a/cmd/minikube/cmd/config/addons_list.go b/cmd/minikube/cmd/config/addons_list.go index 7d88f1ca7d19..8e7dcac94a92 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`") + out.Step(style.Tip, "To see addons list for other profiles use: `minikube addons -p name list`", false) } } @@ -141,5 +141,5 @@ var printAddonsJSON = func(cc *config.ClusterConfig) { } jsonString, _ := json.Marshal(addonsMap) - out.String(string(jsonString)) + out.String(string(jsonString), false) } diff --git a/cmd/minikube/cmd/config/disable.go b/cmd/minikube/cmd/config/disable.go index 198e8b88bddc..3a45104178e2 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`, out.V{"minikube_addon": addon}) + out.Step(style.AddonDisable, `"The '{{.minikube_addon}}' addon is disabled`, false, out.V{"minikube_addon": addon}) }, } diff --git a/cmd/minikube/cmd/config/enable.go b/cmd/minikube/cmd/config/enable.go index d16597f4bd2e..1c3c9dc6e2a3 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") + out.Step(style.Waiting, "enable metrics-server addon instead of heapster addon because heapster is deprecated", false) addon = "metrics-server" } err := addons.SetAndSave(ClusterFlagValue(), addon, "true") @@ -55,11 +55,11 @@ var addonsEnableCmd = &cobra.Command{ minikube{{.profileArg}} addons enable metrics-server -`, out.V{"profileArg": tipProfileArg}) +`, false, out.V{"profileArg": tipProfileArg}) } - out.Step(style.AddonEnable, "The '{{.addonName}}' addon is enabled", out.V{"addonName": addon}) + out.Step(style.AddonEnable, "The '{{.addonName}}' addon is enabled", false, out.V{"addonName": addon}) }, } diff --git a/cmd/minikube/cmd/config/open.go b/cmd/minikube/cmd/config/open.go index 596379e83ff3..50c5b6b45fcc 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...", out.V{"namespace_name": namespace, "service_name": svc}) + out.Step(style.Celebrate, "Opening Kubernetes service {{.namespace_name}}/{{.service_name}} in default browser...", false, 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 1e56e4cfb2f8..402ca41a529e 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) + out.Step(style.Empty, profile, false) os.Exit(0) } diff --git a/cmd/minikube/cmd/config/profile_list.go b/cmd/minikube/cmd/config/profile_list.go index bf316b17d226..80267886792d 100644 --- a/cmd/minikube/cmd/config/profile_list.go +++ b/cmd/minikube/cmd/config/profile_list.go @@ -177,11 +177,11 @@ func printProfilesJSON() { body["valid"] = profilesOrDefault(validProfiles) body["invalid"] = profilesOrDefault(invalidProfiles) jsonString, _ := json.Marshal(body) - out.String(string(jsonString)) + out.String(string(jsonString), false) } else { body["error"] = err jsonString, _ := json.Marshal(body) - out.String(string(jsonString)) + out.String(string(jsonString), false) os.Exit(reason.ExGuestError) } } diff --git a/cmd/minikube/cmd/config/prompt.go b/cmd/minikube/cmd/config/prompt.go index fbaf203a9db1..020d6efb55e4 100644 --- a/cmd/minikube/cmd/config/prompt.go +++ b/cmd/minikube/cmd/config/prompt.go @@ -36,7 +36,7 @@ func AskForYesNoConfirmation(s string, posResponses, negResponses []string) bool reader := bufio.NewReader(os.Stdin) for { - out.String("%s [y/n]: ", s) + out.String("%s [y/n]: ", false, s) response, err := reader.ReadString('\n') if err != nil { @@ -78,7 +78,7 @@ func AskForStaticValueOptional(s string) string { } func getStaticValue(reader *bufio.Reader, s string) string { - out.String("%s", s) + out.String("%s", false, s) response, err := reader.ReadString('\n') if err != nil { diff --git a/cmd/minikube/cmd/dashboard.go b/cmd/minikube/cmd/dashboard.go index b999ac642039..8e697b89b8e6 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...", out.V{"url": url}) + out.Step(style.Celebrate, "Opening {{.url}} in your default browser...", false, 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 9b45c582400d..8ffb033ddb1f 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}}", out.V{"profile": p.Name}) + out.Step(style.Notice, " - {{.profile}}", false, 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") + out.Step(style.DeletingHost, "Successfully deleted all profiles", false) } } 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}}]", out.V{"minikubeDirectory": localpath.MiniPath()}) + out.Step(style.Deleted, "Successfully purged minikube directory located at - [{{.minikubeDirectory}}]", false, 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}}" ...`, out.V{"name": cname}) + out.Step(style.DeletingHost, `Deleting container "{{.name}}" ...`, false, 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}} ...`, out.V{"profile_name": profile.Name, "driver_name": 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}) 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.`, out.V{"name": profile.Name}) + out.Step(style.Deleted, `Removed all traces of the "{{.name}}" cluster.`, false, 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`, out.V{"name": machineName}) + out.Step(style.Notice, `You may need to manually remove the "{{.name}}" VM from your hypervisor`, false, 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}}", out.V{"profile": profile.Name}) + out.Step(style.DeletingHost, "Trying to delete invalid profile {{.profile}}", false, 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}} ...", out.V{"kubernetes_version": cc.KubernetesConfig.KubernetesVersion, "bootstrapper_name": bsName}) + out.Step(style.Resetting, "Uninstalling Kubernetes {{.kubernetes_version}} using {{.bootstrapper_name}} ...", false, 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}} ...`, out.V{"directory": machineDir}) + out.Step(style.DeletingHost, `Removing {{.directory}} ...`, false, 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 046b29ca5b05..e6af98fdd9e0 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}}", out.V{"path": path}) + out.Step(style.Documentation, "Docs have been saved at - {{.path}}", false, out.V{"path": path}) }, } diff --git a/cmd/minikube/cmd/mount.go b/cmd/minikube/cmd/mount.go index f61e2c3736ff..43425fa6051a 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}} ...", out.V{"sourcePath": hostPath, "destinationPath": vmPath}) + out.Step(style.Mounting, "Mounting host path {{.sourcePath}} into VM as {{.destinationPath}} ...", false, 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: ") + out.Step(style.Fileserver, "Userspace file server: ", false) ufs.StartServer(net.JoinHostPort(bindIP, strconv.Itoa(port)), debugVal, hostPath) - out.Step(style.Stopped, "Userspace file server is shutdown") + out.Step(style.Stopped, "Userspace file server is shutdown", false) 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}} ...", out.V{"path": vmPath}) + out.Step(style.Unmount, "Unmounting {{.path}} ...", false, 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}}", out.V{"sourcePath": hostPath, "destinationPath": vmPath}) + out.Step(style.Success, "Successfully mounted {{.sourcePath}} to {{.destinationPath}}", false, out.V{"sourcePath": hostPath, "destinationPath": vmPath}) out.Ln("") - out.Step(style.Notice, "NOTE: This process must stay alive for the mount to be accessible ...") + out.Step(style.Notice, "NOTE: This process must stay alive for the mount to be accessible ...", false) wg.Wait() }, } diff --git a/cmd/minikube/cmd/node_add.go b/cmd/minikube/cmd/node_add.go index 5121fb1affe2..83923ecc76f2 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}}", out.V{"name": name, "cluster": cc.Name}) + out.Step(style.Happy, "Adding node {{.name}} to cluster {{.cluster}}", false, 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}}!", out.V{"name": name, "cluster": cc.Name}) + out.Step(style.Ready, "Successfully added {{.name}} to {{.cluster}}!", false, out.V{"name": name, "cluster": cc.Name}) }, } diff --git a/cmd/minikube/cmd/node_delete.go b/cmd/minikube/cmd/node_delete.go index ae04fab410e0..b1554eca0b1e 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}}", out.V{"name": name, "cluster": co.Config.Name}) + out.Step(style.DeletingHost, "Deleting node {{.name}} from cluster {{.cluster}}", false, 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.", out.V{"name": name}) + out.Step(style.Deleted, "Node {{.name}} was successfully deleted.", false, out.V{"name": name}) }, } diff --git a/cmd/minikube/cmd/node_start.go b/cmd/minikube/cmd/node_start.go index a1711d1e1e52..1c9e0ae5395d 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", out.V{"name": name}) + out.Step(style.Check, "{{.name}} is already running", false, 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}}!", out.V{"name": machineName}) + out.Step(style.Happy, "Successfully started node {{.name}}!", false, out.V{"name": machineName}) }, } diff --git a/cmd/minikube/cmd/node_stop.go b/cmd/minikube/cmd/node_stop.go index db718f311e01..67981cdf45dd 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}}", out.V{"name": machineName}) + out.Step(style.Stopped, "Successfully stopped node {{.name}}", false, out.V{"name": machineName}) }, } diff --git a/cmd/minikube/cmd/options.go b/cmd/minikube/cmd/options.go index 63211aefbbb9..8cd8c2c3cf51 100644 --- a/cmd/minikube/cmd/options.go +++ b/cmd/minikube/cmd/options.go @@ -37,9 +37,9 @@ var optionsCmd = &cobra.Command{ // runOptions handles the executes the flow of "minikube options" func runOptions(cmd *cobra.Command, args []string) { - out.String("The following options can be passed to any command:\n\n") + out.String("The following options can be passed to any command:\n\n", false) cmd.Root().PersistentFlags().VisitAll(func(flag *pflag.Flag) { - out.String(flagUsage(flag)) + out.String(flagUsage(flag), false) }) } diff --git a/cmd/minikube/cmd/pause.go b/cmd/minikube/cmd/pause.go index 858d3bef7d9e..8c69efdf2371 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}} ... ", out.V{"name": name}) + out.Step(style.Pause, "Pausing node {{.name}} ... ", false, 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", out.V{"count": len(ids)}) + out.Step(style.Unpause, "Paused {{.count}} containers", false, out.V{"count": len(ids)}) } else { - out.Step(style.Unpause, "Paused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")}) + out.Step(style.Unpause, "Paused {{.count}} containers in: {{.namespaces}}", false, out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")}) } } diff --git a/cmd/minikube/cmd/service.go b/cmd/minikube/cmd/service.go index 75342c4caa32..97c64882487a 100644 --- a/cmd/minikube/cmd/service.go +++ b/cmd/minikube/cmd/service.go @@ -155,16 +155,16 @@ func openURLs(svc string, urls []string) { _, err := url.Parse(u) if err != nil { klog.Warningf("failed to parse url %q: %v (will not open)", u, err) - out.String(fmt.Sprintf("%s\n", u)) + out.String(fmt.Sprintf("%s\n", u), false) continue } if serviceURLMode { - out.String(fmt.Sprintf("%s\n", u)) + out.String(fmt.Sprintf("%s\n", u), false) continue } - out.Step(style.Celebrate, "Opening service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc}) + out.Step(style.Celebrate, "Opening service {{.namespace_name}}/{{.service_name}} in default browser...", false, 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 aad4cdc4e4d0..3f71298480b9 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!`) + out.Step(style.DryRun, `dry-run validation complete!`, false) 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.") + out.Step(style.Documentation, "To track progress on multi-node clusters, see https://github.com/kubernetes/minikube/issues/7538.", false) } 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}}", out.V{"prefix": prefix, "version": version, "platform": platform()}) + out.Step(style.Happy, "{{.prefix}}minikube {{.version}} on {{.platform}}", false, 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}}", out.V{"name": kcs.ClusterName}) + out.Step(style.Kubectl, "To connect to this cluster, use: --context={{.name}}", false, out.V{"name": kcs.ClusterName}) } else { - out.Step(style.Ready, `Done! kubectl is now configured to use "{{.name}}" cluster and "{{.ns}}" namespace by default`, out.V{"name": machineName, "ns": kcs.Namespace}) + 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}) } }() 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'") + out.Step(style.Tip, "kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'", false) 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`, out.V{"driver": ds.String()}) + out.Step(style.Sparkle, `Using the {{.driver}} driver based on existing profile`, false, 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`, out.V{"driver": ds.String()}) + out.Step(style.Sparkle, `Using the {{.driver}} driver based on user configuration`, false, 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`, out.V{"driver": ds.String()}) + out.Step(style.Sparkle, `Using the {{.driver}} driver based on user configuration`, false, 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:") + out.Step(style.ThumbsDown, "Unable to pick a default driver. Here is what was considered, in preference order:", false) 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}}`, out.V{"driver": pick.Name, "alternates": strings.Join(altNames, ", ")}) + out.Step(style.Sparkle, `Automatically selected the {{.driver}} driver. Other choices: {{.alternates}}`, false, out.V{"driver": pick.Name, "alternates": strings.Join(altNames, ", ")}) } else { - out.Step(style.Sparkle, `Automatically selected the {{.driver}} driver`, out.V{"driver": pick.String()}) + out.Step(style.Sparkle, `Automatically selected the {{.driver}} driver`, false, 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}}`, out.V{"driver": driver.FullName(ds.Name), "fix": translate.T(st.Fix)}) + out.Step(style.Improvement, `For improved {{.driver}} performance, {{.fix}}`, false, 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 ...", out.V{"driver_name": drvName}) + out.Step(style.Confused, "Failed to verify '{{.driver_name}} info' will try again ...", false, 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}}", out.V{"prefix": version.VersionPrefix, "new": defaultVersion}) + 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}) } } diff --git a/cmd/minikube/cmd/start_flags.go b/cmd/minikube/cmd/start_flags.go index 11d0a4dbb051..b53e9ad6c355 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}}", out.V{"name": repository}) + out.Step(style.Success, "Using image repository {{.name}}", false, 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 4cce5d09fa86..4f8b51bfb53d 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.`, out.V{"count": stoppedNodes}) + out.Step(style.Stopped, `{{.count}} nodes stopped.`, false, 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`, out.V{"machineName": machineName}) + out.Step(style.Meh, `"{{.machineName}}" does not exist, nothing to stop`, false, out.V{"machineName": machineName}) nonexistent = true return nil default: diff --git a/cmd/minikube/cmd/unpause.go b/cmd/minikube/cmd/unpause.go index 3bf538c8f591..ca0871a07456 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}} ... ", out.V{"name": name}) + out.Step(style.Pause, "Unpausing node {{.name}} ... ", false, 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", out.V{"count": len(ids)}) + out.Step(style.Pause, "Unpaused {{.count}} containers", false, out.V{"count": len(ids)}) } else { - out.Step(style.Pause, "Unpaused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")}) + out.Step(style.Pause, "Unpaused {{.count}} containers in: {{.namespaces}}", false, 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 709a65ad61cd..f99f03566f9b 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}}`, out.V{"context": cname, "hostname": co.CP.Hostname, "port": co.CP.Port}) + 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}) } else { - out.Step(style.Meh, `No changes required for the "{{.context}}" context`, out.V{"context": cname}) + out.Step(style.Meh, `No changes required for the "{{.context}}" context`, false, 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}}"`, out.V{"context": cname}) + out.Step(style.Kubectl, `Current context is "{{.context}}"`, false, out.V{"context": cname}) } }, } diff --git a/pkg/addons/addons.go b/pkg/addons/addons.go index 12e80fabd58f..81848de8c05d 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`, out.V{"driver": cc.Driver, "port": port}) - out.Step(style.Documentation, `For more information see: https://minikube.sigs.k8s.io/docs/drivers/{{.driver}}`, out.V{"driver": cc.Driver}) + 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}) } } @@ -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.", 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.") + 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) } 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...", out.V{"addon_name": name}) + out.Step(style.HealthCheck, "Verifying {{.addon_name}} addon...", false, 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}}", out.V{"addons": strings.Join(enabledAddons, ", ")}) + out.Step(style.AddonEnable, "Enabled addons: {{.addons}}", false, 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 f0adb3c9f5e7..36fa2abce2f6 100644 --- a/pkg/addons/gcpauth/enable.go +++ b/pkg/addons/gcpauth/enable.go @@ -107,7 +107,7 @@ func enableAddon(cfg *config.ClusterConfig) error { gcloud config set project -or set the GOOGLE_CLOUD_PROJECT environment variable.`) +or set the GOOGLE_CLOUD_PROJECT environment variable.`, false) // 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 a85c04402431..e6c4528fba9c 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) ...", out.V{"name": cnm.String()}) + out.Step(style.CNI, "Configuring {{.name}} (Container Networking Interface) ...", false, 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...") + out.Step(style.HealthCheck, "Verifying Kubernetes components...", false) // 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.") + out.Step(style.Tip, "Please free up disk or prune images.", false) if driver.IsVM(drv) { - out.Step(style.Stopped, "Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ") + out.Step(style.Stopped, "Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ", false) } else if drv == oci.Docker && runtime.GOOS != "linux" { - out.Step(style.Stopped, "Please increse Desktop's disk size.") + out.Step(style.Stopped, "Please increse Desktop's disk size.", false) if runtime.GOOS == "darwin" { - out.Step(style.Documentation, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) + out.Step(style.Documentation, "Documentation: {{.url}}", false, out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) } if runtime.GOOS == "windows" { - out.Step(style.Documentation, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-windows/"}) + out.Step(style.Documentation, "Documentation: {{.url}}", false, 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") + out.Step(style.Tip, "Check if you have unnecessary pods running by running 'kubectl get po -A", false) if driver.IsVM(drv) { - out.Step(style.Stopped, "Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ") + out.Step(style.Stopped, "Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ", false) } else if drv == oci.Docker && runtime.GOOS != "linux" { - out.Step(style.Stopped, "Consider increasing Docker Desktop's memory size.") + out.Step(style.Stopped, "Consider increasing Docker Desktop's memory size.", false) if runtime.GOOS == "darwin" { - out.Step(style.Documentation, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) + out.Step(style.Documentation, "Documentation: {{.url}}", false, out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) } if runtime.GOOS == "windows" { - out.Step(style.Documentation, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-windows/"}) + out.Step(style.Documentation, "Documentation: {{.url}}", false, 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 099eb8adcbc2..ee262c70062c 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) + out.Step(style.URL, url, false) return nil } } diff --git a/pkg/minikube/download/driver.go b/pkg/minikube/download/driver.go index 2a3f12194980..ef7cda181418 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}}:", out.V{"driver": name}) + out.Step(style.FileDownload, "Downloading driver {{.driver}}:", false, 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 549cb055b35d..77bd5769097c 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 ...") + out.Step(style.ISODownload, "Downloading VM boot image ...", false) urlWithChecksum := isoURL + "?checksum=file:" + isoURL + ".sha256" if skipChecksum { diff --git a/pkg/minikube/download/preload.go b/pkg/minikube/download/preload.go index 668c4edf56fc..f11f0be0cce3 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 ...", out.V{"version": k8sVersion}) + out.Step(style.FileDownload, "Downloading Kubernetes {{.version}} preload ...", false, 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 ffec3a951e4f..ac1b00921215 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", out.V{"driver": name, "example": example.String()}) + 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()}) 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 43b4c08e6722..98db0334e45d 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) + out.Step(style.LogEntry, l, false) } } } @@ -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, "") + out.Step(style.Empty, "", false) } - out.Step(style.Empty, "==> {{.name}} <==", out.V{"name": name}) + out.Step(style.Empty, "==> {{.name}} <==", false, 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()) + out.Step(style.Empty, scanner.Text(), false) } } diff --git a/pkg/minikube/machine/advice.go b/pkg/minikube/machine/advice.go index d9ea37b175cd..60b0e4b9c207 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:", out.V{"driver_name": driver}) + 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}) if driver == oci.Docker || driver == oci.Podman { - out.String("\n\t") + out.String("\n\t", false) out.Step(style.Empty, `- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers. - {{.driver_name}} system prune --volumes`, out.V{"driver_name": driver}) + {{.driver_name}} system prune --volumes`, false, out.V{"driver_name": driver}) } - out.String("\n\t") - out.Step(style.Empty, `- Restart your {{.driver_name}} service`, 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}) if runtime.GOOS != "linux" { - out.String("\n\t") - out.Step(style.Empty, `- Ensure your {{.driver_name}} daemon has access to enough CPU/memory resources.`, out.V{"driver_name": driver}) + 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}) if runtime.GOOS == "darwin" && driver == oci.Docker { - out.String("\n\t") - out.Step(style.Empty, `- Docs https://docs.docker.com/docker-for-mac/#resources`, out.V{"driver_name": driver}) + out.String("\n\t", false) + out.Step(style.Empty, `- Docs https://docs.docker.com/docker-for-mac/#resources`, false, out.V{"driver_name": driver}) } if runtime.GOOS == "windows" && driver == oci.Docker { - out.String("\n\t") - out.Step(style.Empty, `- Docs https://docs.docker.com/docker-for-windows/#resources`, out.V{"driver_name": driver}) + 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.String("\n\t") + out.String("\n\t", false) out.Step(style.Empty, `- Delete and recreate minikube cluster minikube delete - minikube start --driver={{.driver_name}}`, out.V{"driver_name": driver}) + minikube start --driver={{.driver_name}}`, false, 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 636c5bc729bf..a0d629cd143a 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}} ...`, out.V{"profile_name": machineName, "driver_name": host.DriverName}) + out.Step(style.DeletingHost, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, false, 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 8e0eeb7f77e4..668ffe26ced0 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.`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + 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}) 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}} ...`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + out.Step(style.Running, `Updating the running {{.driver_name}} "{{.cluster}}" {{.machine_type}} ...`, false, 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}}" ...`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + out.Step(style.Restarting, `Restarting existing {{.driver_name}} {{.machine_type}} for "{{.cluster}}" ...`, false, 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:", out.V{"driver_name": drver}) + out.Step(style.Notice, "Noticed you have an activated docker-env on {{.driver_name}} driver in this terminal:", false, 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:", out.V{"driver_name": drver}) + out.Step(style.Notice, "Noticed you have an activated podman-env on {{.driver_name}} driver in this terminal:", false, 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 d2f3066a7ed7..7d8c748226d3 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}}", out.V{"pretty_name": osReleaseInfo.PrettyName}) + out.Step(style.Provisioner, "OS release is {{.pretty_name}}", false, 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 9314ec703a4a..0d1316e1301d 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) ...", out.V{"number_of_cpus": info.CPUs, "memory_size": info.Memory, "disk_size": info.DiskSize}) + 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}) } 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) ...", out.V{"driver_name": cfg.Driver, "number_of_cpus": cfg.CPUs, "memory_size": cfg.Memory, "machine_type": machineType}) + 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}) 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) ...", 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, "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}) } // 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 3984f2e9aa0e..58fa10c6e120 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}}" ...`, out.V{"name": machineName}) + out.Step(style.Stopping, `Stopping node "{{.name}}" ...`, false, 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 ...`, out.V{"profile_name": h.Name}) + out.Step(style.Shutdown, `Powering off "{{.profile_name}}" via SSH ...`, false, 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 d3e67adcc40f..251c267200f7 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.`, out.V{"cluster": name}) + out.Step(style.Shrug, `Profile "{{.cluster}}" not found. Run "minikube profile list" to view all profiles.`, false, 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.`, out.V{"name": cp.Name}) + out.Step(style.Shrug, `The control plane node "{{.name}}" does not exist.`, false, 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`) + out.Step(style.Shrug, `The control plane node must be running for this command`, false) exitTip("start", name, reason.ExGuestUnavailable) } if hs != state.Running.String() { - out.Step(style.Shrug, `The control plane node is not running (state={{.state}})`, out.V{"name": cp.Name, "state": hs}) + out.Step(style.Shrug, `The control plane node is not running (state={{.state}})`, false, 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!`, out.V{"name": name}) + out.Step(style.Shrug, `The control plane for "{{.name}}" is paused!`, false, 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}})`, out.V{"state": as.String()}) + out.Step(style.Shrug, `This control plane is not running! (state={{.state}})`, false, 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}}"`, out.V{"command": command}) + out.Step(style.Workaround, `To start a cluster, run: "{{.command}}"`, false, out.V{"command": command}) os.Exit(code) } diff --git a/pkg/minikube/node/cache.go b/pkg/minikube/node/cache.go index 3017d31472ce..5b4c97feb0ca 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!") + out.Step(style.Check, "Download complete!", false) 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 ...") + out.Step(style.Pulling, "Pulling base image ...", false) g.Go(func() error { baseImg := cc.KicBaseImage if baseImg == kic.BaseImage && len(cc.KubernetesConfig.ImageRepository) != 0 { @@ -171,7 +171,7 @@ func waitDownloadKicBaseImage(g *errgroup.Group) { 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: 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 a967370b52b8..766f3d61e3d0 100644 --- a/pkg/minikube/node/config.go +++ b/pkg/minikube/node/config.go @@ -40,7 +40,8 @@ import ( func showVersionInfo(k8sVersion string, cr cruntime.Manager) { version, _ := cr.Version() register.Reg.SetStep(register.PreparingKubernetes) - out.SpinnerStep(cr.Style(), "Preparing Kubernetes {{.k8sVersion}} on {{.runtime}} {{.runtimeVersion}} ...", out.V{"k8sVersion": k8sVersion, "runtime": cr.Name(), "runtimeVersion": version}) + out.Step(cr.Style(), "Preparing Kubernetes {{.k8sVersion}} on {{.runtime}} {{.runtimeVersion}} ...", true, out.V{"k8sVersion": k8sVersion, "runtime": cr.Name(), "runtimeVersion": version}) + //out.SpinnerStep(cr.Style(), "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}) } @@ -58,7 +59,7 @@ func configureMounts(wg *sync.WaitGroup) { return } - out.Step(style.Mounting, "Creating mount {{.name}} ...", out.V{"name": viper.GetString(mountString)}) + out.Step(style.Mounting, "Creating mount {{.name}} ...", false, 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 5995270aab68..6ae372cea322 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}}", out.V{"name": name, "cluster": cc.Name}) + out.Step(style.ThumbsUp, "Starting control plane node {{.name}} in cluster {{.cluster}}", false, out.V{"name": name, "cluster": cc.Name}) } else { - out.Step(style.ThumbsUp, "Starting node {{.name}} in cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name}) + out.Step(style.ThumbsUp, "Starting node {{.name}} in cluster {{.cluster}}", false, 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:") + out.Step(style.Internet, "Found network options:", false) 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", out.V{"documentation_url": "https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/"}) + 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/"}) 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 ...") + out.Step(style.StartingNone, "Configuring local host environment ...", false) 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 f9740236f786..db2db12ef440 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}}`, out.V{"version": latestVersion, "url": url}) - out.Step(style.Tip, "To disable this notice, run: 'minikube config set WantUpdateNotification false'\n") + 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) return true } return false diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go index a10b15ab0c24..87851c81dd1a 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -76,47 +76,32 @@ type fdWriter interface { type V map[string]interface{} // Step writes a stylized and templated message to stdout -func Step(st style.Enum, format string, a ...V) { +func Step(st style.Enum, format string, spinner bool, a ...V) { if st == style.Option { Infof(format, a...) return } - outStyled := stylized(st, useColor, format, a...) + outStyled := stylized(st, useColor, spinner, format, a...) if JSON { register.PrintStep(outStyled) return } register.RecordStep(outStyled) - String(outStyled) -} - -// Step writes a stylized and templated message to stdout -func SpinnerStep(st style.Enum, format string, a ...V) { - if st == style.Option { - Infof(format, a...) - return - } - outStyled := spinnerStylized(st, useColor, format, a...) - if JSON { - register.PrintStep(outStyled) - return - } - register.RecordStep(outStyled) - SpinnerString(outStyled) + String(outStyled, spinner) } // Infof is used for informational logs (options, env variables, etc) func Infof(format string, a ...V) { - outStyled := stylized(style.Option, useColor, format, a...) + outStyled := stylized(style.Option, useColor, false, format, a...) if JSON { register.PrintInfo(outStyled) return } - String(outStyled) + String(outStyled, false) } // String writes a basic formatted string to stdout -func String(format string, a ...interface{}) { +func String(format string, spinner bool, a ...interface{}) { // Flush log buffer so that output order makes sense klog.Flush() @@ -133,25 +118,10 @@ func String(format string, a ...interface{}) { if err != nil { klog.Errorf("Fprintf failed: %v", err) } -} - -// SpinnerString writes a basic formatted string and spinner to stdout -func SpinnerString(format string, a ...interface{}) { - // Flush log buffer so that output order makes sense - klog.Flush() - - if outFile == nil { - klog.Warningf("[unset outFile]: %s", fmt.Sprintf(format, a...)) - return - } - klog.Infof(format, a...) - _, err := fmt.Fprintf(outFile, format, a...) - if err != nil { - klog.Errorf("Fprintf failed: %v", err) + if spinner{ + spin.Start() } - spin.Start() - } // Ln writes a basic formatted string with a newline to stdout @@ -160,12 +130,12 @@ func Ln(format string, a ...interface{}) { klog.Warningf("please use out.T to log steps in JSON") return } - String(format+"\n", a...) + String(format+"\n", false, a...) } // ErrT writes a stylized and templated error message to stderr func ErrT(st style.Enum, format string, a ...V) { - errStyled := stylized(st, useColor, format, a...) + errStyled := stylized(st, useColor, false, format, a...) Err(errStyled) } @@ -197,7 +167,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, a...) + Step(style.Success, format, false, a...) } // FatalT is a shortcut for writing a templated fatal message to stderr @@ -208,7 +178,7 @@ func FatalT(format string, a ...V) { // WarningT is a shortcut for writing a templated warning message to stderr func WarningT(format string, a ...V) { if JSON { - register.PrintWarning(stylized(style.Warning, useColor, format, a...)) + register.PrintWarning(stylized(style.Warning, useColor, false, format, a...)) return } ErrT(style.Warning, format, a...) @@ -282,12 +252,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}}:", V{"entry": name}) + Step(style.Failure, "Problems detected in {{.entry}}:", false, V{"entry": name}) if len(lines) > MaxLogEntries { lines = lines[:MaxLogEntries] } for _, l := range lines { - Step(style.LogEntry, l) + Step(style.LogEntry, l, false) } } } diff --git a/pkg/minikube/out/out_style.go b/pkg/minikube/out/out_style.go index 2fffa6cf98ef..a2c5bd4eaf2b 100644 --- a/pkg/minikube/out/out_style.go +++ b/pkg/minikube/out/out_style.go @@ -51,19 +51,10 @@ func applyStyle(st style.Enum, useColor bool, format string, spinner bool) strin } // stylized applies formatting to the provided template -func stylized(st style.Enum, useColor bool, format string, a ...V) string { +func stylized(st style.Enum, useColor bool, spinner bool, format string, a ...V) string { if a == nil { a = []V{{}} } - format = applyStyle(st, useColor, format, false) + format = applyStyle(st, useColor, format, spinner) return Fmt(format, a...) -} - -// spinnerStylized applies formatting to the provided template -func spinnerStylized(st style.Enum, useColor bool, format string, a ...V) string { - if a == nil { - a = []V{{}} - } - format = applyStyle(st, useColor, format, true) - return Fmt(format, a...) -} +} \ No newline at end of file diff --git a/pkg/minikube/out/out_style_test.go b/pkg/minikube/out/out_style_test.go index fb231d333ac0..897513be629e 100644 --- a/pkg/minikube/out/out_style_test.go +++ b/pkg/minikube/out/out_style_test.go @@ -83,7 +83,7 @@ func TestApplyStyle(t *testing.T) { } for _, test := range tests { t.Run(test.description, func(t *testing.T) { - rawGot := applyStyle(test.styleEnum, test.useColor, test.format) + rawGot := applyStyle(test.styleEnum, test.useColor, test.format, false) got := strings.TrimSpace(rawGot) if got != test.expected { t.Errorf("Expected '%v' but got '%v'", test.expected, got) @@ -139,7 +139,7 @@ func TestApplyTemplateFormating(t *testing.T) { } for _, test := range tests { t.Run(test.description, func(t *testing.T) { - rawGot := stylized(test.styleEnum, test.useColor, test.format, test.a...) + rawGot := stylized(test.styleEnum, test.useColor, false, test.format, test.a...) got := strings.TrimSpace(rawGot) if got != test.expected { t.Errorf("Expected '%v' but got '%v'", test.expected, got) diff --git a/pkg/minikube/out/out_test.go b/pkg/minikube/out/out_test.go index 9094be289c72..fa915557a9d2 100644 --- a/pkg/minikube/out/out_test.go +++ b/pkg/minikube/out/out_test.go @@ -57,7 +57,7 @@ func TestOutT(t *testing.T) { os.Setenv(OverrideEnv, strconv.FormatBool(override)) f := tests.NewFakeFile() SetOutFile(f) - Step(tc.style, tc.message, tc.params) + Step(tc.style, tc.message, false, tc.params) got := f.String() want := tc.wantASCII if override { @@ -89,9 +89,9 @@ func TestOut(t *testing.T) { SetOutFile(f) ErrLn("unrelated message") if tc.arg == nil { - String(tc.format) + String(tc.format, false) } else { - String(tc.format, tc.arg) + String(tc.format, false, tc.arg) } got := f.String() if got != tc.want { diff --git a/pkg/minikube/service/service.go b/pkg/minikube/service/service.go index 091158a3c7c4..1b08c0587265 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", out.V{"namespace_name": namespace, "service_name": service}) + out.Step(style.Sad, "service {{.namespace_name}}/{{.service_name}} has no node port", false, 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 d850e92bef6a..5f31eafb3bbf 100644 --- a/pkg/minikube/tunnel/kic/ssh_conn.go +++ b/pkg/minikube/tunnel/kic/ssh_conn.go @@ -71,10 +71,11 @@ func createSSHConn(name, sshPort, sshKey string, svc *v1.Service) *sshConn { out.Step( style.Warning, "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.") + out.Step(style.Permissions, "sudo permission will be asked for it.", false) command = "sudo" sshArgs = append([]string{"ssh"}, sshArgs...) @@ -131,7 +132,7 @@ func createSSHConnWithRandomPorts(name, sshPort, sshKey string, svc *v1.Service) } func (c *sshConn) startAndWait() error { - out.Step(style.Running, "Starting tunnel for service {{.service}}.", out.V{"service": c.service}) + out.Step(style.Running, "Starting tunnel for service {{.service}}.", false, out.V{"service": c.service}) err := c.cmd.Start() if err != nil { @@ -145,7 +146,7 @@ func (c *sshConn) startAndWait() error { } func (c *sshConn) stop() error { - out.Step(style.Stopping, "Stopping tunnel for service {{.service}}.", out.V{"service": c.service}) + out.Step(style.Stopping, "Stopping tunnel for service {{.service}}.", false, out.V{"service": c.service}) return c.cmd.Process.Kill() } From f7abca67f762fc3e84d4fec94517ce887fb8a9ac Mon Sep 17 00:00:00 2001 From: alonyb Date: Sun, 6 Dec 2020 21:55:41 -0500 Subject: [PATCH 12/30] remove comment line --- pkg/minikube/node/config.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/minikube/node/config.go b/pkg/minikube/node/config.go index 766f3d61e3d0..f0c443b5777e 100644 --- a/pkg/minikube/node/config.go +++ b/pkg/minikube/node/config.go @@ -41,7 +41,6 @@ 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.SpinnerStep(cr.Style(), "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}) } From 23dc03c75baf3b03e73e0229eed316d6d3c5d95b Mon Sep 17 00:00:00 2001 From: alonyb Date: Mon, 7 Dec 2020 09:55:10 -0500 Subject: [PATCH 13/30] fix delete unittest --- cmd/minikube/cmd/delete_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/delete_test.go b/cmd/minikube/cmd/delete_test.go index 9fd4e47a12d8..5dfec859f418 100644 --- a/cmd/minikube/cmd/delete_test.go +++ b/cmd/minikube/cmd/delete_test.go @@ -199,7 +199,8 @@ func TestDeleteAllProfiles(t *testing.T) { t.Error(err) } - if numberOfTotalProfileDirs != len(validProfiles)+len(inValidProfiles) { + const numberOfTotalProfiles = 9 + if numberOfTotalProfiles != len(validProfiles)+len(inValidProfiles) { t.Errorf("ListProfiles length = %d, expected %d\nvalid: %v\ninvalid: %v\n", len(validProfiles)+len(inValidProfiles), numberOfTotalProfileDirs, validProfiles, inValidProfiles) } From 64f489575855df7c4e721e43348b574c081ad6c4 Mon Sep 17 00:00:00 2001 From: alonyb Date: Mon, 7 Dec 2020 09:55:56 -0500 Subject: [PATCH 14/30] fix lint if statement --- pkg/minikube/out/out.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go index 87851c81dd1a..516d0f7c37f5 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -20,8 +20,6 @@ package out import ( "bytes" "fmt" - "github.com/briandowns/spinner" - isatty "github.com/mattn/go-isatty" "html" "html/template" "io" @@ -30,6 +28,9 @@ import ( "strings" "time" + "github.com/briandowns/spinner" + isatty "github.com/mattn/go-isatty" + "k8s.io/klog/v2" "k8s.io/minikube/pkg/minikube/out/register" "k8s.io/minikube/pkg/minikube/style" @@ -111,7 +112,7 @@ func String(format string, spinner bool, a ...interface{}) { } klog.Infof(format, a...) - if spin.Active() == true { + if spin.Active() { spin.Stop() } _, err := fmt.Fprintf(outFile, format, a...) @@ -119,7 +120,7 @@ func String(format string, spinner bool, a ...interface{}) { klog.Errorf("Fprintf failed: %v", err) } - if spinner{ + if spinner { spin.Start() } } From 32bb174a9de254c3f51e90ae35a6878741a7d4d2 Mon Sep 17 00:00:00 2001 From: alonyb Date: Mon, 7 Dec 2020 09:56:16 -0500 Subject: [PATCH 15/30] fix lint goimports --- pkg/minikube/node/config.go | 11 ++++++----- pkg/minikube/out/out_style.go | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/minikube/node/config.go b/pkg/minikube/node/config.go index f0c443b5777e..3ebc2e565827 100644 --- a/pkg/minikube/node/config.go +++ b/pkg/minikube/node/config.go @@ -18,6 +18,12 @@ package node import ( "fmt" + "os" + "os/exec" + "path/filepath" + "strconv" + "sync" + "github.com/spf13/viper" "k8s.io/klog/v2" "k8s.io/minikube/pkg/minikube/config" @@ -30,11 +36,6 @@ import ( "k8s.io/minikube/pkg/minikube/reason" "k8s.io/minikube/pkg/minikube/style" "k8s.io/minikube/pkg/util/lock" - "os" - "os/exec" - "path/filepath" - "strconv" - "sync" ) func showVersionInfo(k8sVersion string, cr cruntime.Manager) { diff --git a/pkg/minikube/out/out_style.go b/pkg/minikube/out/out_style.go index a2c5bd4eaf2b..eef867fc99b0 100644 --- a/pkg/minikube/out/out_style.go +++ b/pkg/minikube/out/out_style.go @@ -57,4 +57,4 @@ func stylized(st style.Enum, useColor bool, spinner bool, format string, a ...V) } format = applyStyle(st, useColor, format, spinner) return Fmt(format, a...) -} \ No newline at end of file +} From 7a9979b6e70faf6f11edd43984c156845c70e16a Mon Sep 17 00:00:00 2001 From: alonyb Date: Mon, 7 Dec 2020 14:56:27 -0500 Subject: [PATCH 16/30] restore go sum --- go.sum | 5 ----- 1 file changed, 5 deletions(-) diff --git a/go.sum b/go.sum index 0ac836ad8d17..1e101bb2b32f 100644 --- a/go.sum +++ b/go.sum @@ -556,7 +556,6 @@ github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPg github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible h1:xmapqc1AyLoB+ddYT6r04bD9lIjlOqGaREovi0SzFaE= github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0 h1:pMen7vLs8nvgEYhywH3KDWJIJTeEr2ULsVWHWYHQyBs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f h1:Jnx61latede7zDD3DiiP4gmNz33uK0U5HDUaF0a/HVQ= @@ -587,7 +586,6 @@ github.com/googleapis/gnostic v0.1.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTV github.com/googleapis/gnostic v0.2.2/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.3.0 h1:CcQijm0XKekKjP/YCz28LXVSpgguuB+nCxaSjCe09y0= github.com/googleapis/gnostic v0.3.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/googleinterns/cloud-operations-api-mock v0.0.0-20200709193332-a1e58c29bdd3 h1:eHv/jVY/JNop1xg2J9cBb4EzyMpWZoNCP1BslSAIkOI= github.com/googleinterns/cloud-operations-api-mock v0.0.0-20200709193332-a1e58c29bdd3/go.mod h1:h/KNeRx7oYU4SpA4SoY7W2/NxDKEEVuwA6j9A27L4OI= github.com/gookit/color v1.2.4/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= @@ -1108,7 +1106,6 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= @@ -1506,7 +1503,6 @@ golang.org/x/tools v0.0.0-20200527183253-8e7acdbce89d h1:SR+e35rACZFBohNb4Om1ibX golang.org/x/tools v0.0.0-20200527183253-8e7acdbce89d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200701151220-7cb253f4c4f8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed h1:+qzWo37K31KxduIYaBeMqJ8MUOyTayOQKpH9aDPLMSY= golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= @@ -1665,7 +1661,6 @@ gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.1.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= From 6b89930222398fb5a93d68becfdd9ff987b750df Mon Sep 17 00:00:00 2001 From: alonyb Date: Tue, 8 Dec 2020 14:37:00 -0500 Subject: [PATCH 17/30] add older lines in go sum --- go.sum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.sum b/go.sum index 1e101bb2b32f..dc2228030910 100644 --- a/go.sum +++ b/go.sum @@ -92,6 +92,7 @@ github.com/DataDog/sketches-go v0.0.1/go.mod h1:Q5DbzQ+3AkgGwymQO7aZFNP7ns2lZKGt github.com/Djarvur/go-err113 v0.0.0-20200410182137-af658d038157/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/Djarvur/go-err113 v0.1.0/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20191009163259-e802c2cb94ae/go.mod h1:mjwGPas4yKduTyubHvD1Atl9r1rUq8DfVy+gkVvZ+oo= +github.com/GoogleCloudPlatform/opentelemetry-operations-go v0.13.0 h1:Gx9IxOjR9ug5Ad8YbafxJ6N2g6oDj/Q419tYHdd1od4= github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20190822182118-27a4ced34534/go.mod h1:iroGtC8B3tQiqtds1l+mgk/BBOrxbqjH+eUfFQYRc14= github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v0.13.0 h1:fjKUtfldCPIF4nIzAAj3LzP8Lrd3DuRIMiFdOsj4fLc= github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v0.13.0/go.mod h1:q/paYxLXKVhwfC3lzLfhtL54fAx14wzMN9DundQOBMc= @@ -1191,6 +1192,7 @@ go.opencensus.io v0.22.3 h1:8sGtKOrtQqkN1bp2AtX+misvLIlOmsEsNd+9NIcPEm8= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4 h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opentelemetry.io v0.1.0 h1:EANZoRCOP+A3faIlw/iN6YEWoYb1vleZRKm1EvH8T48= go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= From a763e05b167dc3938964c5589d428f19d1b89dde Mon Sep 17 00:00:00 2001 From: alonyb Date: Tue, 8 Dec 2020 16:46:02 -0500 Subject: [PATCH 18/30] change bool to second parameter --- cmd/minikube/cmd/config/addons_list.go | 2 +- cmd/minikube/cmd/config/disable.go | 2 +- cmd/minikube/cmd/config/enable.go | 8 +++--- cmd/minikube/cmd/config/open.go | 2 +- cmd/minikube/cmd/config/profile.go | 2 +- cmd/minikube/cmd/dashboard.go | 2 +- cmd/minikube/cmd/delete.go | 20 ++++++------- cmd/minikube/cmd/generate-docs.go | 2 +- cmd/minikube/cmd/mount.go | 12 ++++---- cmd/minikube/cmd/node_add.go | 4 +-- cmd/minikube/cmd/node_delete.go | 4 +-- cmd/minikube/cmd/node_start.go | 4 +-- cmd/minikube/cmd/node_stop.go | 2 +- cmd/minikube/cmd/pause.go | 6 ++-- cmd/minikube/cmd/service.go | 2 +- cmd/minikube/cmd/start.go | 30 ++++++++++---------- cmd/minikube/cmd/start_flags.go | 2 +- cmd/minikube/cmd/stop.go | 4 +-- cmd/minikube/cmd/unpause.go | 6 ++-- cmd/minikube/cmd/update-context.go | 6 ++-- pkg/addons/addons.go | 12 ++++---- pkg/addons/gcpauth/enable.go | 4 +-- pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 24 ++++++++-------- pkg/minikube/browser/browser.go | 2 +- pkg/minikube/download/driver.go | 2 +- pkg/minikube/download/iso.go | 2 +- pkg/minikube/download/preload.go | 2 +- pkg/minikube/driver/install.go | 2 +- pkg/minikube/logs/logs.go | 8 +++--- pkg/minikube/machine/advice.go | 18 ++++++------ pkg/minikube/machine/delete.go | 2 +- pkg/minikube/machine/fix.go | 10 +++---- pkg/minikube/machine/info.go | 2 +- pkg/minikube/machine/start.go | 6 ++-- pkg/minikube/machine/stop.go | 4 +-- pkg/minikube/mustload/mustload.go | 14 ++++----- pkg/minikube/node/cache.go | 8 +++--- pkg/minikube/node/config.go | 4 +-- pkg/minikube/node/start.go | 10 +++---- pkg/minikube/notify/notify.go | 4 +-- pkg/minikube/out/out.go | 8 +++--- pkg/minikube/service/service.go | 2 +- pkg/minikube/tunnel/kic/ssh_conn.go | 9 +++--- 43 files changed, 140 insertions(+), 141 deletions(-) diff --git a/cmd/minikube/cmd/config/addons_list.go b/cmd/minikube/cmd/config/addons_list.go index 8e7dcac94a92..481fa7c72ef1 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 3a45104178e2..778a720b50ec 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 1c3c9dc6e2a3..c27475edaef2 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 50c5b6b45fcc..a2b8e22f6394 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 402ca41a529e..beeb93fe7078 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 8e697b89b8e6..46743314abe1 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 8ffb033ddb1f..a19d9493dd4e 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 e6af98fdd9e0..bd6ab9e839d7 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 43425fa6051a..e673341e5ede 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 83923ecc76f2..4eed2980eba4 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 b1554eca0b1e..047c6e37205d 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 1c9e0ae5395d..f2740dda63dc 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 67981cdf45dd..250880830805 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 8c69efdf2371..f2a3c3e1d5b7 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 97c64882487a..cef2055b544d 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 3f71298480b9..08231b6e0766 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 b53e9ad6c355..8803d043d561 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 4f8b51bfb53d..9d63808a8c7c 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 ca0871a07456..bb866dfc9da6 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 f99f03566f9b..1ac5a26997d0 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 81848de8c05d..e92f57959876 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 36fa2abce2f6..285c8e7396a9 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 e6c4528fba9c..fea3128d4998 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 ee262c70062c..193016528fdc 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 ef7cda181418..e5945721e1a1 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 77bd5769097c..4a5e46e0e1be 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 f11f0be0cce3..07682aea3bd3 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 ac1b00921215..59ccaf6b64cd 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 98db0334e45d..acaf3f3c2311 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 60b0e4b9c207..7a257045ab79 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 a0d629cd143a..1a9ed9771776 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 668ffe26ced0..7cbccbc8879d 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 7d8c748226d3..89796ee41a6a 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 0d1316e1301d..7843fc84ab75 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 58fa10c6e120..75cb062c9854 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 251c267200f7..f6ee7070ad10 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 5b4c97feb0ca..bc9c3df668fa 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 3ebc2e565827..8e4013e9afc1 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 6ae372cea322..002c1fbe5c66 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 db2db12ef440..a7903ba4ce26 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 516d0f7c37f5..3350c7db91ef 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 1b08c0587265..bbe1fdd2598f 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 5f31eafb3bbf..55f7413d34a3 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() } From 291ea787e38b8c52db865fe6707dde295787a6bd Mon Sep 17 00:00:00 2001 From: alonyb Date: Wed, 9 Dec 2020 09:19:26 -0500 Subject: [PATCH 19/30] fix repo with upstream --- cmd/minikube/cmd/stop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/stop.go b/cmd/minikube/cmd/stop.go index 8f54dfae0e22..9d5d91901e6c 100644 --- a/cmd/minikube/cmd/stop.go +++ b/cmd/minikube/cmd/stop.go @@ -102,7 +102,7 @@ func runStop(cmd *cobra.Command, args []string) { schedule.KillExisting(profilesToStop) if cancelScheduledStop { register.Reg.SetStep(register.Done) - out.Step(style.Stopped, `All existing scheduled stops cancelled`) + out.Step(style.Stopped, false, `All existing scheduled stops cancelled`) return } From 73ea4f255588eef3e4379f5906527900f07499e2 Mon Sep 17 00:00:00 2001 From: alonyb Date: Wed, 9 Dec 2020 09:34:18 -0500 Subject: [PATCH 20/30] add comment and fix bool param --- pkg/minikube/out/out.go | 1 + pkg/minikube/out/out_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go index 3350c7db91ef..07ef4d890435 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -112,6 +112,7 @@ func String(format string, spinner bool, a ...interface{}) { } klog.Infof(format, a...) + // if spin is active from a previous step, it will stop spinner displaying if spin.Active() { spin.Stop() } diff --git a/pkg/minikube/out/out_test.go b/pkg/minikube/out/out_test.go index fa915557a9d2..8ff345272534 100644 --- a/pkg/minikube/out/out_test.go +++ b/pkg/minikube/out/out_test.go @@ -57,7 +57,7 @@ func TestOutT(t *testing.T) { os.Setenv(OverrideEnv, strconv.FormatBool(override)) f := tests.NewFakeFile() SetOutFile(f) - Step(tc.style, tc.message, false, tc.params) + Step(tc.style, false, tc.message, tc.params) got := f.String() want := tc.wantASCII if override { From 032b43c5b78cbcecfde4381accdab04da5b97433 Mon Sep 17 00:00:00 2001 From: alonyb Date: Wed, 9 Dec 2020 09:35:47 -0500 Subject: [PATCH 21/30] fix lint --- pkg/addons/addons.go | 4 ++-- pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 4 ++-- pkg/minikube/machine/fix.go | 2 +- pkg/minikube/node/config.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/addons/addons.go b/pkg/addons/addons.go index e92f57959876..791578d259a3 100644 --- a/pkg/addons/addons.go +++ b/pkg/addons/addons.go @@ -347,7 +347,7 @@ func verifyAddonStatusInternal(cc *config.ClusterConfig, name string, val string label, ok := addonPodLabels[name] if ok && enable { - out.Step(style.HealthCheck, false,"Verifying {{.addon_name}} addon...", 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, false,"Enabled addons: {{.addons}}", 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/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index fea3128d4998..8dcd4a7daeef 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -990,14 +990,14 @@ func adviseNodePressure(err error, name string, drv string) { out.WarningT("The node {{.name}} has ran out of memory.", out.V{"name": name}) 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, false,"Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ") + 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, false, "Consider increasing Docker Desktop's memory size.") if runtime.GOOS == "darwin" { 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, false,"Documentation: {{.url}}", 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/machine/fix.go b/pkg/minikube/machine/fix.go index 7cbccbc8879d..85ece409533d 100644 --- a/pkg/minikube/machine/fix.go +++ b/pkg/minikube/machine/fix.go @@ -141,7 +141,7 @@ func recreateIfNeeded(api libmachine.API, cc *config.ClusterConfig, n *config.No } if !recreated { - out.Step(style.Restarting, false,`Restarting existing {{.driver_name}} {{.machine_type}} for "{{.cluster}}" ...`, 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) diff --git a/pkg/minikube/node/config.go b/pkg/minikube/node/config.go index 8e4013e9afc1..fc20895abe00 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(), true,"Preparing Kubernetes {{.k8sVersion}} on {{.runtime}} {{.runtimeVersion}} ...", 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}) } From e45b42fdbd83d89565277bf892d60174ba017a19 Mon Sep 17 00:00:00 2001 From: alonyb Date: Wed, 9 Dec 2020 09:56:00 -0500 Subject: [PATCH 22/30] fix unittest --- cmd/minikube/cmd/delete_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/minikube/cmd/delete_test.go b/cmd/minikube/cmd/delete_test.go index 5dfec859f418..9fd4e47a12d8 100644 --- a/cmd/minikube/cmd/delete_test.go +++ b/cmd/minikube/cmd/delete_test.go @@ -199,8 +199,7 @@ func TestDeleteAllProfiles(t *testing.T) { t.Error(err) } - const numberOfTotalProfiles = 9 - if numberOfTotalProfiles != len(validProfiles)+len(inValidProfiles) { + if numberOfTotalProfileDirs != len(validProfiles)+len(inValidProfiles) { t.Errorf("ListProfiles length = %d, expected %d\nvalid: %v\ninvalid: %v\n", len(validProfiles)+len(inValidProfiles), numberOfTotalProfileDirs, validProfiles, inValidProfiles) } From c24eda630c13d30f88988d6bd871a59a6585a1a2 Mon Sep 17 00:00:00 2001 From: alonyb Date: Wed, 9 Dec 2020 18:17:01 -0500 Subject: [PATCH 23/30] change false to constant --- cmd/minikube/cmd/config/addons_list.go | 2 +- cmd/minikube/cmd/config/disable.go | 2 +- cmd/minikube/cmd/config/enable.go | 6 ++-- cmd/minikube/cmd/config/open.go | 2 +- cmd/minikube/cmd/config/profile.go | 2 +- cmd/minikube/cmd/dashboard.go | 2 +- cmd/minikube/cmd/delete.go | 4 +-- cmd/minikube/cmd/generate-docs.go | 2 +- cmd/minikube/cmd/mount.go | 10 +++--- cmd/minikube/cmd/node_add.go | 4 +-- cmd/minikube/cmd/node_delete.go | 2 +- cmd/minikube/cmd/node_start.go | 4 +-- cmd/minikube/cmd/node_stop.go | 2 +- cmd/minikube/cmd/pause.go | 6 ++-- cmd/minikube/cmd/service.go | 2 +- cmd/minikube/cmd/start.go | 24 ++++++------- cmd/minikube/cmd/stop.go | 6 ++-- cmd/minikube/cmd/unpause.go | 6 ++-- cmd/minikube/cmd/update-context.go | 6 ++-- pkg/addons/gcpauth/enable.go | 2 +- pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 4 +-- pkg/minikube/browser/browser.go | 2 +- pkg/minikube/download/driver.go | 2 +- pkg/minikube/logs/logs.go | 8 ++--- pkg/minikube/machine/advice.go | 14 ++++---- pkg/minikube/machine/delete.go | 2 +- pkg/minikube/machine/fix.go | 10 +++--- pkg/minikube/machine/info.go | 2 +- pkg/minikube/machine/start.go | 6 ++-- pkg/minikube/machine/stop.go | 4 +-- pkg/minikube/mustload/mustload.go | 14 ++++---- pkg/minikube/node/cache.go | 6 ++-- pkg/minikube/node/config.go | 4 +-- pkg/minikube/node/start.go | 10 +++--- pkg/minikube/notify/notify.go | 4 +-- pkg/minikube/out/out.go | 38 ++++++++++++++++---- pkg/minikube/service/service.go | 2 +- pkg/minikube/tunnel/kic/ssh_conn.go | 8 ++--- 38 files changed, 130 insertions(+), 106 deletions(-) diff --git a/cmd/minikube/cmd/config/addons_list.go b/cmd/minikube/cmd/config/addons_list.go index 481fa7c72ef1..f9f6e1015294 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, false, "To see addons list for other profiles use: `minikube addons -p name list`") + out.Step(style.Tip, out.NoSpinner, "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 778a720b50ec..67bada9d4ca8 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, false, `"The '{{.minikube_addon}}' addon is disabled`, out.V{"minikube_addon": addon}) + out.Step(style.AddonDisable, out.NoSpinner, `"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 c27475edaef2..1ac81165e7a6 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, false, "enable metrics-server addon instead of heapster addon because heapster is deprecated") + out.Step(style.Waiting, out.NoSpinner, "enable metrics-server addon instead of heapster addon because heapster is deprecated") addon = "metrics-server" } err := addons.SetAndSave(ClusterFlagValue(), addon, "true") @@ -51,7 +51,7 @@ var addonsEnableCmd = &cobra.Command{ if ClusterFlagValue() != constants.DefaultClusterName { tipProfileArg = fmt.Sprintf(" -p %s", ClusterFlagValue()) } - out.Step(style.Tip, false, `Some dashboard features require the metrics-server addon. To enable all features please run: + out.Step(style.Tip, out.NoSpinner, `Some dashboard features require the metrics-server addon. To enable all features please run: minikube{{.profileArg}} addons enable metrics-server @@ -59,7 +59,7 @@ var addonsEnableCmd = &cobra.Command{ } - out.Step(style.AddonEnable, false, "The '{{.addonName}}' addon is enabled", out.V{"addonName": addon}) + out.Step(style.AddonEnable, out.NoSpinner, "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 a2b8e22f6394..79edbf090234 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, false, "Opening Kubernetes service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc}) + out.Step(style.Celebrate, out.NoSpinner, "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 beeb93fe7078..bf56708198ac 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, false, profile) + out.Step(style.Empty, out.NoSpinner, profile) os.Exit(0) } diff --git a/cmd/minikube/cmd/dashboard.go b/cmd/minikube/cmd/dashboard.go index 46743314abe1..eb3b3cc89ee6 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, false, "Opening {{.url}} in your default browser...", out.V{"url": url}) + out.Step(style.Celebrate, out.NoSpinner, "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 60a638ef94ad..41d14bf787da 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, false, " - {{.profile}}", out.V{"profile": p.Name}) + out.Step(style.Notice, out.NoSpinner, " - {{.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, false, "Successfully deleted all profiles") + out.Step(style.DeletingHost, out.NoSpinner, "Successfully deleted all profiles") } } else { if len(args) > 0 { diff --git a/cmd/minikube/cmd/generate-docs.go b/cmd/minikube/cmd/generate-docs.go index bd6ab9e839d7..e944d8706024 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, false, "Docs have been saved at - {{.path}}", out.V{"path": path}) + out.Step(style.Documentation, out.NoSpinner, "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 e673341e5ede..4a6808dedf7e 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, false, "Mounting host path {{.sourcePath}} into VM as {{.destinationPath}} ...", out.V{"sourcePath": hostPath, "destinationPath": vmPath}) + out.Step(style.Mounting, out.NoSpinner, "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,7 +168,7 @@ var mountCmd = &cobra.Command{ if cfg.Type == nineP { wg.Add(1) go func() { - out.Step(style.Fileserver, false, "Userspace file server: ") + out.Step(style.Fileserver, out.NoSpinner, "Userspace file server: ") ufs.StartServer(net.JoinHostPort(bindIP, strconv.Itoa(port)), debugVal, hostPath) 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, false, "Unmounting {{.path}} ...", out.V{"path": vmPath}) + out.Step(style.Unmount, out.NoSpinner, "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, false, "Successfully mounted {{.sourcePath}} to {{.destinationPath}}", out.V{"sourcePath": hostPath, "destinationPath": vmPath}) + out.Step(style.Success, out.NoSpinner, "Successfully mounted {{.sourcePath}} to {{.destinationPath}}", out.V{"sourcePath": hostPath, "destinationPath": vmPath}) out.Ln("") - out.Step(style.Notice, false, "NOTE: This process must stay alive for the mount to be accessible ...") + out.Step(style.Notice, out.NoSpinner, "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 4eed2980eba4..4259573f25cc 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, false, "Adding node {{.name}} to cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name}) + out.Step(style.Happy, out.NoSpinner, "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, false, "Successfully added {{.name}} to {{.cluster}}!", out.V{"name": name, "cluster": cc.Name}) + out.Step(style.Ready, out.NoSpinner, "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 047c6e37205d..2e223f24c97b 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, false, "Deleting node {{.name}} from cluster {{.cluster}}", out.V{"name": name, "cluster": co.Config.Name}) + out.Step(style.DeletingHost, out.NoSpinner, "Deleting node {{.name}} from cluster {{.cluster}}", out.V{"name": name, "cluster": co.Config.Name}) n, err := node.Delete(*co.Config, name) if err != nil { diff --git a/cmd/minikube/cmd/node_start.go b/cmd/minikube/cmd/node_start.go index 0e8bea7d315f..ae2bca54c055 100644 --- a/cmd/minikube/cmd/node_start.go +++ b/cmd/minikube/cmd/node_start.go @@ -51,7 +51,7 @@ var nodeStartCmd = &cobra.Command{ machineName := driver.MachineName(*cc, *n) if machine.IsRunning(api, machineName) { - out.Step(style.Check, false, "{{.name}} is already running", out.V{"name": name}) + out.Step(style.Check, out.NoSpinner, "{{.name}} is already running", out.V{"name": name}) os.Exit(0) } @@ -79,7 +79,7 @@ var nodeStartCmd = &cobra.Command{ exit.Error(reason.GuestNodeStart, "failed to start node", err) } } - out.Step(style.Happy, false, "Successfully started node {{.name}}!", out.V{"name": machineName}) + out.Step(style.Happy, out.NoSpinner, "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 250880830805..406f25da248f 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, false, "Successfully stopped node {{.name}}", out.V{"name": machineName}) + out.Step(style.Stopped, out.NoSpinner, "Successfully stopped node {{.name}}", out.V{"name": machineName}) }, } diff --git a/cmd/minikube/cmd/pause.go b/cmd/minikube/cmd/pause.go index f2a3c3e1d5b7..2b14ba076cf1 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, false, "Pausing node {{.name}} ... ", out.V{"name": name}) + out.Step(style.Pause, out.NoSpinner, "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, false, "Paused {{.count}} containers", out.V{"count": len(ids)}) + out.Step(style.Unpause, out.NoSpinner, "Paused {{.count}} containers", out.V{"count": len(ids)}) } else { - out.Step(style.Unpause, false, "Paused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")}) + out.Step(style.Unpause, out.NoSpinner, "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 cef2055b544d..11ac57414e1b 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, false, "Opening service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc}) + out.Step(style.Celebrate, out.NoSpinner, "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 08231b6e0766..fcd425d293a6 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, false, `dry-run validation complete!`) + out.Step(style.DryRun, out.NoSpinner, `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, false, "To track progress on multi-node clusters, see https://github.com/kubernetes/minikube/issues/7538.") + out.Step(style.Documentation, out.NoSpinner, "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, false, "{{.prefix}}minikube {{.version}} on {{.platform}}", out.V{"prefix": prefix, "version": version, "platform": platform()}) + out.Step(style.Happy, out.NoSpinner, "{{.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, false, "To connect to this cluster, use: --context={{.name}}", out.V{"name": kcs.ClusterName}) + out.Step(style.Kubectl, out.NoSpinner, "To connect to this cluster, use: --context={{.name}}", out.V{"name": kcs.ClusterName}) } else { - 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}) + out.Step(style.Ready, out.NoSpinner, `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, false, "kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'") + out.Step(style.Tip, out.NoSpinner, "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, false, `Using the {{.driver}} driver based on existing profile`, out.V{"driver": ds.String()}) + out.Step(style.Sparkle, out.NoSpinner, `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, false, `Using the {{.driver}} driver based on user configuration`, out.V{"driver": ds.String()}) + out.Step(style.Sparkle, out.NoSpinner, `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, false, `Using the {{.driver}} driver based on user configuration`, out.V{"driver": ds.String()}) + out.Step(style.Sparkle, out.NoSpinner, `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, false, "Unable to pick a default driver. Here is what was considered, in preference order:") + out.Step(style.ThumbsDown, out.NoSpinner, "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, false, `Automatically selected the {{.driver}} driver. Other choices: {{.alternates}}`, out.V{"driver": pick.Name, "alternates": strings.Join(altNames, ", ")}) + out.Step(style.Sparkle, out.NoSpinner, `Automatically selected the {{.driver}} driver. Other choices: {{.alternates}}`, out.V{"driver": pick.Name, "alternates": strings.Join(altNames, ", ")}) } else { - out.Step(style.Sparkle, false, `Automatically selected the {{.driver}} driver`, out.V{"driver": pick.String()}) + out.Step(style.Sparkle, out.NoSpinner, `Automatically selected the {{.driver}} driver`, out.V{"driver": pick.String()}) } return pick, alts, false } diff --git a/cmd/minikube/cmd/stop.go b/cmd/minikube/cmd/stop.go index 9d5d91901e6c..8c8b3ba4f353 100644 --- a/cmd/minikube/cmd/stop.go +++ b/cmd/minikube/cmd/stop.go @@ -102,7 +102,7 @@ func runStop(cmd *cobra.Command, args []string) { schedule.KillExisting(profilesToStop) if cancelScheduledStop { register.Reg.SetStep(register.Done) - out.Step(style.Stopped, false, `All existing scheduled stops cancelled`) + out.Step(style.Stopped, out.NoSpinner, `All existing scheduled stops cancelled`) return } @@ -125,7 +125,7 @@ func runStop(cmd *cobra.Command, args []string) { register.Reg.SetStep(register.Done) if stoppedNodes > 0 { - out.Step(style.Stopped, false, `{{.count}} nodes stopped.`, out.V{"count": stoppedNodes}) + out.Step(style.Stopped, out.NoSpinner, `{{.count}} nodes stopped.`, out.V{"count": stoppedNodes}) } } @@ -171,7 +171,7 @@ func stop(api libmachine.API, machineName string) bool { switch err := errors.Cause(err).(type) { case mcnerror.ErrHostDoesNotExist: - out.Step(style.Meh, false, `"{{.machineName}}" does not exist, nothing to stop`, out.V{"machineName": machineName}) + out.Step(style.Meh, out.NoSpinner, `"{{.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 bb866dfc9da6..5bb71851c89e 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, false, "Unpausing node {{.name}} ... ", out.V{"name": name}) + out.Step(style.Pause, out.NoSpinner, "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, false, "Unpaused {{.count}} containers", out.V{"count": len(ids)}) + out.Step(style.Pause, out.NoSpinner, "Unpaused {{.count}} containers", out.V{"count": len(ids)}) } else { - out.Step(style.Pause, false, "Unpaused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")}) + out.Step(style.Pause, out.NoSpinner, "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 1ac5a26997d0..afb0d7bdad8d 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, false, `"{{.context}}" context has been updated to point to {{.hostname}}:{{.port}}`, out.V{"context": cname, "hostname": co.CP.Hostname, "port": co.CP.Port}) + out.Step(style.Celebrate, out.NoSpinner, `"{{.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, false, `No changes required for the "{{.context}}" context`, out.V{"context": cname}) + out.Step(style.Meh, out.NoSpinner, `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, false, `Current context is "{{.context}}"`, out.V{"context": cname}) + out.Step(style.Kubectl, out.NoSpinner, `Current context is "{{.context}}"`, out.V{"context": cname}) } }, } diff --git a/pkg/addons/gcpauth/enable.go b/pkg/addons/gcpauth/enable.go index 285c8e7396a9..7d0d362b5eab 100644 --- a/pkg/addons/gcpauth/enable.go +++ b/pkg/addons/gcpauth/enable.go @@ -103,7 +103,7 @@ func enableAddon(cfg *config.ClusterConfig) error { } out.WarningT("Could not determine a Google Cloud project, which might be ok.") - out.Step(style.Tip, false, `To set your Google Cloud project, run: + out.Step(style.Tip, out.NoSpinner, `To set your Google Cloud project, run: gcloud config set project diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index 8dcd4a7daeef..418e794c50aa 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, false, "Configuring {{.name}} (Container Networking Interface) ...", out.V{"name": cnm.String()}) + out.Step(style.CNI, out.NoSpinner, "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, false, "Verifying Kubernetes components...") + out.Step(style.HealthCheck, out.NoSpinner, "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 { diff --git a/pkg/minikube/browser/browser.go b/pkg/minikube/browser/browser.go index 193016528fdc..f6509ca9344b 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, false, url) + out.Step(style.URL, out.NoSpinner, url) return nil } } diff --git a/pkg/minikube/download/driver.go b/pkg/minikube/download/driver.go index e5945721e1a1..db4df6f4d1d9 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, false, "Downloading driver {{.driver}}:", out.V{"driver": name}) + out.Step(style.FileDownload, out.NoSpinner, "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/logs/logs.go b/pkg/minikube/logs/logs.go index acaf3f3c2311..afb011913ace 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, false, l) + out.Step(style.LogEntry, out.NoSpinner, 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, out.NoSpinner, "") } - out.Step(style.Empty, false, "==> {{.name}} <==", out.V{"name": name}) + out.Step(style.Empty, out.NoSpinner, "==> {{.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, false, scanner.Text()) + out.Step(style.Empty, out.NoSpinner, scanner.Text()) } } diff --git a/pkg/minikube/machine/advice.go b/pkg/minikube/machine/advice.go index 7a257045ab79..c8aae424fb4f 100644 --- a/pkg/minikube/machine/advice.go +++ b/pkg/minikube/machine/advice.go @@ -38,29 +38,29 @@ func MaybeDisplayAdvice(err error, driver string) { } if errors.Is(err, oci.ErrExitedUnexpectedly) || errors.Is(err, oci.ErrDaemonInfo) { - 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}) + out.Step(style.Tip, out.NoSpinner, "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, false, `- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers. + out.Step(style.Empty, out.NoSpinner, `- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers. {{.driver_name}} system prune --volumes`, out.V{"driver_name": driver}) } out.String("\n\t", false) - out.Step(style.Empty, false, `- Restart your {{.driver_name}} service`, out.V{"driver_name": driver}) + out.Step(style.Empty, out.NoSpinner, `- Restart your {{.driver_name}} service`, out.V{"driver_name": driver}) if runtime.GOOS != "linux" { out.String("\n\t", false) - out.Step(style.Empty, false, `- Ensure your {{.driver_name}} daemon has access to enough CPU/memory resources.`, out.V{"driver_name": driver}) + out.Step(style.Empty, out.NoSpinner, `- 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, false, `- Docs https://docs.docker.com/docker-for-mac/#resources`, out.V{"driver_name": driver}) + out.Step(style.Empty, out.NoSpinner, `- 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, false, `- Docs https://docs.docker.com/docker-for-windows/#resources`, out.V{"driver_name": driver}) + out.Step(style.Empty, out.NoSpinner, `- Docs https://docs.docker.com/docker-for-windows/#resources`, out.V{"driver_name": driver}) } } out.String("\n\t", false) - out.Step(style.Empty, false, `- Delete and recreate minikube cluster + out.Step(style.Empty, out.NoSpinner, `- Delete and recreate minikube cluster minikube delete 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 1a9ed9771776..cd1133d9a937 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, false, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, out.V{"profile_name": machineName, "driver_name": host.DriverName}) + out.Step(style.DeletingHost, out.NoSpinner, `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 85ece409533d..c25350a2c419 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, false, `{{.driver_name}} "{{.cluster}}" {{.machine_type}} is missing, will recreate.`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + out.Step(style.Shrug, out.NoSpinner, `{{.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, false, `Updating the running {{.driver_name}} "{{.cluster}}" {{.machine_type}} ...`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + out.Step(style.Running, out.NoSpinner, `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, false, `Restarting existing {{.driver_name}} {{.machine_type}} for "{{.cluster}}" ...`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + out.Step(style.Restarting, out.NoSpinner, `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, false, "Noticed you have an activated docker-env on {{.driver_name}} driver in this terminal:", out.V{"driver_name": drver}) + out.Step(style.Notice, out.NoSpinner, "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, false, "Noticed you have an activated podman-env on {{.driver_name}} driver in this terminal:", out.V{"driver_name": drver}) + out.Step(style.Notice, out.NoSpinner, "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 89796ee41a6a..fb95a2158f1a 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, false, "OS release is {{.pretty_name}}", out.V{"pretty_name": osReleaseInfo.PrettyName}) + out.Step(style.Provisioner, out.NoSpinner, "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 7843fc84ab75..3dd4ec499f57 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, 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}) + out.Step(style.StartingNone, out.NoSpinner, "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, 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}) + out.Step(style.StartingVM, out.NoSpinner, "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, 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}) + out.Step(style.StartingVM, out.NoSpinner, "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 75cb062c9854..9642992ce01a 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, false, `Stopping node "{{.name}}" ...`, out.V{"name": machineName}) + out.Step(style.Stopping, out.NoSpinner, `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, false, `Powering off "{{.profile_name}}" via SSH ...`, out.V{"profile_name": h.Name}) + out.Step(style.Shutdown, out.NoSpinner, `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 f6ee7070ad10..109e91441723 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, false, `Profile "{{.cluster}}" not found. Run "minikube profile list" to view all profiles.`, out.V{"cluster": name}) + out.Step(style.Shrug, out.NoSpinner, `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, false, `The control plane node "{{.name}}" does not exist.`, out.V{"name": cp.Name}) + out.Step(style.Shrug, out.NoSpinner, `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, false, `The control plane node must be running for this command`) + out.Step(style.Shrug, out.NoSpinner, `The control plane node must be running for this command`) exitTip("start", name, reason.ExGuestUnavailable) } if hs != state.Running.String() { - out.Step(style.Shrug, false, `The control plane node is not running (state={{.state}})`, out.V{"name": cp.Name, "state": hs}) + out.Step(style.Shrug, out.NoSpinner, `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, false, `The control plane for "{{.name}}" is paused!`, out.V{"name": name}) + out.Step(style.Shrug, out.NoSpinner, `The control plane for "{{.name}}" is paused!`, out.V{"name": name}) exitTip("unpause", name, reason.ExSvcConfig) } if as != state.Running { - out.Step(style.Shrug, false, `This control plane is not running! (state={{.state}})`, out.V{"state": as.String()}) + out.Step(style.Shrug, out.NoSpinner, `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, false, `To start a cluster, run: "{{.command}}"`, out.V{"command": command}) + out.Step(style.Workaround, out.NoSpinner, `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 a47b55a7e0f3..b95d2823a500 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, false, "Download complete!") + out.Step(style.Check, out.NoSpinner, "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, false, "Pulling base image ...") + out.Step(style.Pulling, out.NoSpinner, "Pulling base image ...") g.Go(func() error { baseImg := cc.KicBaseImage if baseImg == kic.BaseImage && len(cc.KubernetesConfig.ImageRepository) != 0 { @@ -170,7 +170,7 @@ 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, false, `Please visit the following link for documentation around this: + out.Step(style.Documentation, out.NoSpinner, `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 `) } diff --git a/pkg/minikube/node/config.go b/pkg/minikube/node/config.go index fc20895abe00..36e013f2662f 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(), true, "Preparing Kubernetes {{.k8sVersion}} on {{.runtime}} {{.runtimeVersion}} ...", out.V{"k8sVersion": k8sVersion, "runtime": cr.Name(), "runtimeVersion": version}) + out.Step(cr.Style(), out.Spinning, "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, false, "Creating mount {{.name}} ...", out.V{"name": viper.GetString(mountString)}) + out.Step(style.Mounting, out.NoSpinner, "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 002c1fbe5c66..ef9ddb7e3eb5 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, false, "Starting control plane node {{.name}} in cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name}) + out.Step(style.ThumbsUp, out.NoSpinner, "Starting control plane node {{.name}} in cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name}) } else { - out.Step(style.ThumbsUp, false, "Starting node {{.name}} in cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name}) + out.Step(style.ThumbsUp, out.NoSpinner, "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, false, "Found network options:") + out.Step(style.Internet, out.NoSpinner, "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, false, "Please see {{.documentation_url}} for more details", out.V{"documentation_url": "https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/"}) + out.Step(style.Documentation, out.NoSpinner, "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, false, "Configuring local host environment ...") + out.Step(style.StartingNone, out.NoSpinner, "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 a7903ba4ce26..89cd3182e72b 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, 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") + out.Step(style.Celebrate, out.NoSpinner, `minikube {{.version}} is available! Download it: {{.url}}`, out.V{"version": latestVersion, "url": url}) + out.Step(style.Tip, out.NoSpinner, "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 07ef4d890435..334937d13cb9 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -61,11 +61,16 @@ var ( // JSON is whether or not we should output stdout in JSON format. Set using SetJSON() JSON = false // spin is spinner showed at starting minikube - spin = spinner.New(spinner.CharSets[9], 100*time.Millisecond) + spin = spinner.New(spinner.CharSets[SpinnerCharacter], 100*time.Millisecond) ) // MaxLogEntries controls the number of log entries to show for each source -const MaxLogEntries = 3 +const ( + MaxLogEntries = 3 + Spinning = true + NoSpinner = false + SpinnerCharacter = 9 +) // fdWriter is the subset of file.File that implements io.Writer and Fd() type fdWriter interface { @@ -88,7 +93,11 @@ func Step(st style.Enum, spinner bool, format string, a ...V) { return } register.RecordStep(outStyled) - String(outStyled, spinner) + if spinner { + spinnerString(outStyled) + } else { + String(outStyled) + } } // Infof is used for informational logs (options, env variables, etc) @@ -102,7 +111,7 @@ func Infof(format string, a ...V) { } // String writes a basic formatted string to stdout -func String(format string, spinner bool, a ...interface{}) { +func String(format string, a ...interface{}) { // Flush log buffer so that output order makes sense klog.Flush() @@ -120,10 +129,25 @@ func String(format string, spinner bool, a ...interface{}) { if err != nil { klog.Errorf("Fprintf failed: %v", err) } +} - if spinner { - spin.Start() +// spinnerString writes a basic formatted string to stdout with spinner character +func spinnerString(format string, a ...interface{}) { + // Flush log buffer so that output order makes sense + klog.Flush() + + if outFile == nil { + klog.Warningf("[unset outFile]: %s", fmt.Sprintf(format, a...)) + return + } + + klog.Infof(format, a...) + _, err := fmt.Fprintf(outFile, format, a...) + if err != nil { + klog.Errorf("Fprintf failed: %v", err) } + // Start spinning at the end of the printed line + spin.Start() } // Ln writes a basic formatted string with a newline to stdout @@ -132,7 +156,7 @@ func Ln(format string, a ...interface{}) { klog.Warningf("please use out.T to log steps in JSON") return } - String(format+"\n", false, a...) + String(format+"\n", a...) } // ErrT writes a stylized and templated error message to stderr diff --git a/pkg/minikube/service/service.go b/pkg/minikube/service/service.go index bbe1fdd2598f..8a999d5c2a88 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, false, "service {{.namespace_name}}/{{.service_name}} has no node port", out.V{"namespace_name": namespace, "service_name": service}) + out.Step(style.Sad, out.NoSpinner, "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 55f7413d34a3..390b7526e14a 100644 --- a/pkg/minikube/tunnel/kic/ssh_conn.go +++ b/pkg/minikube/tunnel/kic/ssh_conn.go @@ -69,12 +69,12 @@ func createSSHConn(name, sshPort, sshKey string, svc *v1.Service) *sshConn { if askForSudo { out.Step( - style.Warning, false, + style.Warning, out.NoSpinner, "The service {{.service}} requires privileged ports to be exposed: {{.ports}}", out.V{"service": svc.Name, "ports": fmt.Sprintf("%v", privilegedPorts)}, ) - out.Step(style.Permissions, false, "sudo permission will be asked for it.") + out.Step(style.Permissions, out.NoSpinner, "sudo permission will be asked for it.") command = "sudo" sshArgs = append([]string{"ssh"}, sshArgs...) @@ -131,7 +131,7 @@ func createSSHConnWithRandomPorts(name, sshPort, sshKey string, svc *v1.Service) } func (c *sshConn) startAndWait() error { - out.Step(style.Running, false, "Starting tunnel for service {{.service}}.", out.V{"service": c.service}) + out.Step(style.Running, out.NoSpinner, "Starting tunnel for service {{.service}}.", out.V{"service": c.service}) err := c.cmd.Start() if err != nil { @@ -145,7 +145,7 @@ func (c *sshConn) startAndWait() error { } func (c *sshConn) stop() error { - out.Step(style.Stopping, false, "Stopping tunnel for service {{.service}}.", out.V{"service": c.service}) + out.Step(style.Stopping, out.NoSpinner, "Stopping tunnel for service {{.service}}.", out.V{"service": c.service}) return c.cmd.Process.Kill() } From 42aac91acdc15cd939b9c35633d3cee5840d16e7 Mon Sep 17 00:00:00 2001 From: alonyb Date: Wed, 9 Dec 2020 18:22:22 -0500 Subject: [PATCH 24/30] remove bool var from String func --- cmd/minikube/cmd/config/addons_list.go | 2 +- cmd/minikube/cmd/config/profile_list.go | 4 ++-- cmd/minikube/cmd/config/prompt.go | 4 ++-- cmd/minikube/cmd/options.go | 4 ++-- cmd/minikube/cmd/service.go | 4 ++-- pkg/minikube/machine/advice.go | 12 ++++++------ pkg/minikube/out/out.go | 2 +- pkg/minikube/out/out_test.go | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cmd/minikube/cmd/config/addons_list.go b/cmd/minikube/cmd/config/addons_list.go index f9f6e1015294..c55f1c946c0a 100644 --- a/cmd/minikube/cmd/config/addons_list.go +++ b/cmd/minikube/cmd/config/addons_list.go @@ -141,5 +141,5 @@ var printAddonsJSON = func(cc *config.ClusterConfig) { } jsonString, _ := json.Marshal(addonsMap) - out.String(string(jsonString), false) + out.String(string(jsonString)) } diff --git a/cmd/minikube/cmd/config/profile_list.go b/cmd/minikube/cmd/config/profile_list.go index 80267886792d..bf316b17d226 100644 --- a/cmd/minikube/cmd/config/profile_list.go +++ b/cmd/minikube/cmd/config/profile_list.go @@ -177,11 +177,11 @@ func printProfilesJSON() { body["valid"] = profilesOrDefault(validProfiles) body["invalid"] = profilesOrDefault(invalidProfiles) jsonString, _ := json.Marshal(body) - out.String(string(jsonString), false) + out.String(string(jsonString)) } else { body["error"] = err jsonString, _ := json.Marshal(body) - out.String(string(jsonString), false) + out.String(string(jsonString)) os.Exit(reason.ExGuestError) } } diff --git a/cmd/minikube/cmd/config/prompt.go b/cmd/minikube/cmd/config/prompt.go index 020d6efb55e4..fbaf203a9db1 100644 --- a/cmd/minikube/cmd/config/prompt.go +++ b/cmd/minikube/cmd/config/prompt.go @@ -36,7 +36,7 @@ func AskForYesNoConfirmation(s string, posResponses, negResponses []string) bool reader := bufio.NewReader(os.Stdin) for { - out.String("%s [y/n]: ", false, s) + out.String("%s [y/n]: ", s) response, err := reader.ReadString('\n') if err != nil { @@ -78,7 +78,7 @@ func AskForStaticValueOptional(s string) string { } func getStaticValue(reader *bufio.Reader, s string) string { - out.String("%s", false, s) + out.String("%s", s) response, err := reader.ReadString('\n') if err != nil { diff --git a/cmd/minikube/cmd/options.go b/cmd/minikube/cmd/options.go index 8cd8c2c3cf51..63211aefbbb9 100644 --- a/cmd/minikube/cmd/options.go +++ b/cmd/minikube/cmd/options.go @@ -37,9 +37,9 @@ var optionsCmd = &cobra.Command{ // runOptions handles the executes the flow of "minikube options" func runOptions(cmd *cobra.Command, args []string) { - out.String("The following options can be passed to any command:\n\n", false) + out.String("The following options can be passed to any command:\n\n") cmd.Root().PersistentFlags().VisitAll(func(flag *pflag.Flag) { - out.String(flagUsage(flag), false) + out.String(flagUsage(flag)) }) } diff --git a/cmd/minikube/cmd/service.go b/cmd/minikube/cmd/service.go index 11ac57414e1b..c1da80aa6e66 100644 --- a/cmd/minikube/cmd/service.go +++ b/cmd/minikube/cmd/service.go @@ -155,12 +155,12 @@ func openURLs(svc string, urls []string) { _, err := url.Parse(u) if err != nil { klog.Warningf("failed to parse url %q: %v (will not open)", u, err) - out.String(fmt.Sprintf("%s\n", u), false) + out.String(fmt.Sprintf("%s\n", u)) continue } if serviceURLMode { - out.String(fmt.Sprintf("%s\n", u), false) + out.String(fmt.Sprintf("%s\n", u)) continue } diff --git a/pkg/minikube/machine/advice.go b/pkg/minikube/machine/advice.go index c8aae424fb4f..8ad0150b6c01 100644 --- a/pkg/minikube/machine/advice.go +++ b/pkg/minikube/machine/advice.go @@ -40,26 +40,26 @@ func MaybeDisplayAdvice(err error, driver string) { if errors.Is(err, oci.ErrExitedUnexpectedly) || errors.Is(err, oci.ErrDaemonInfo) { out.Step(style.Tip, out.NoSpinner, "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.String("\n\t") out.Step(style.Empty, out.NoSpinner, `- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers. {{.driver_name}} system prune --volumes`, out.V{"driver_name": driver}) } - out.String("\n\t", false) + out.String("\n\t") out.Step(style.Empty, out.NoSpinner, `- Restart your {{.driver_name}} service`, out.V{"driver_name": driver}) if runtime.GOOS != "linux" { - out.String("\n\t", false) + out.String("\n\t") out.Step(style.Empty, out.NoSpinner, `- 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.String("\n\t") out.Step(style.Empty, out.NoSpinner, `- 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.String("\n\t") out.Step(style.Empty, out.NoSpinner, `- Docs https://docs.docker.com/docker-for-windows/#resources`, out.V{"driver_name": driver}) } } - out.String("\n\t", false) + out.String("\n\t") out.Step(style.Empty, out.NoSpinner, `- Delete and recreate minikube cluster minikube delete minikube start --driver={{.driver_name}}`, out.V{"driver_name": driver}) diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go index 334937d13cb9..691befd67210 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -107,7 +107,7 @@ func Infof(format string, a ...V) { register.PrintInfo(outStyled) return } - String(outStyled, false) + String(outStyled) } // String writes a basic formatted string to stdout diff --git a/pkg/minikube/out/out_test.go b/pkg/minikube/out/out_test.go index 8ff345272534..ff5074036a89 100644 --- a/pkg/minikube/out/out_test.go +++ b/pkg/minikube/out/out_test.go @@ -89,9 +89,9 @@ func TestOut(t *testing.T) { SetOutFile(f) ErrLn("unrelated message") if tc.arg == nil { - String(tc.format, false) + String(tc.format) } else { - String(tc.format, false, tc.arg) + String(tc.format, tc.arg) } got := f.String() if got != tc.want { From e7ca2921fa3475515ab4ffd3923fe57a429da26a Mon Sep 17 00:00:00 2001 From: alonyb Date: Wed, 9 Dec 2020 18:31:21 -0500 Subject: [PATCH 25/30] change more false by constant --- cmd/minikube/cmd/delete.go | 16 ++++++++-------- cmd/minikube/cmd/mount.go | 2 +- cmd/minikube/cmd/node_delete.go | 2 +- cmd/minikube/cmd/start.go | 6 +++--- cmd/minikube/cmd/start_flags.go | 2 +- pkg/addons/addons.go | 12 ++++++------ pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 20 ++++++++++---------- pkg/minikube/download/iso.go | 2 +- pkg/minikube/download/preload.go | 2 +- pkg/minikube/driver/install.go | 2 +- pkg/minikube/out/out.go | 8 ++++---- pkg/minikube/out/out_test.go | 2 +- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/cmd/minikube/cmd/delete.go b/cmd/minikube/cmd/delete.go index 41d14bf787da..261e4fa2e94b 100644 --- a/cmd/minikube/cmd/delete.go +++ b/cmd/minikube/cmd/delete.go @@ -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, false, "Successfully purged minikube directory located at - [{{.minikubeDirectory}}]", out.V{"minikubeDirectory": localpath.MiniPath()}) + out.Step(style.Deleted, out.NoSpinner, "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, false, `Deleting container "{{.name}}" ...`, out.V{"name": cname}) + out.Step(style.DeletingHost, out.NoSpinner, `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, false, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, out.V{"profile_name": profile.Name, "driver_name": profile.Config.Driver}) + out.Step(style.DeletingHost, out.NoSpinner, `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, false, `Removed all traces of the "{{.name}}" cluster.`, out.V{"name": profile.Name}) + out.Step(style.Deleted, out.NoSpinner, `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, false, `You may need to manually remove the "{{.name}}" VM from your hypervisor`, out.V{"name": machineName}) + out.Step(style.Notice, out.NoSpinner, `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, false, "Trying to delete invalid profile {{.profile}}", out.V{"profile": profile.Name}) + out.Step(style.DeletingHost, out.NoSpinner, "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, false, "Uninstalling Kubernetes {{.kubernetes_version}} using {{.bootstrapper_name}} ...", out.V{"kubernetes_version": cc.KubernetesConfig.KubernetesVersion, "bootstrapper_name": bsName}) + out.Step(style.Resetting, out.NoSpinner, "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, false, `Removing {{.directory}} ...`, out.V{"directory": machineDir}) + out.Step(style.DeletingHost, out.NoSpinner, `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/mount.go b/cmd/minikube/cmd/mount.go index 4a6808dedf7e..486dd9ed0d17 100644 --- a/cmd/minikube/cmd/mount.go +++ b/cmd/minikube/cmd/mount.go @@ -170,7 +170,7 @@ var mountCmd = &cobra.Command{ go func() { out.Step(style.Fileserver, out.NoSpinner, "Userspace file server: ") ufs.StartServer(net.JoinHostPort(bindIP, strconv.Itoa(port)), debugVal, hostPath) - out.Step(style.Stopped, false, "Userspace file server is shutdown") + out.Step(style.Stopped, out.NoSpinner, "Userspace file server is shutdown") wg.Done() }() } diff --git a/cmd/minikube/cmd/node_delete.go b/cmd/minikube/cmd/node_delete.go index 2e223f24c97b..ed511a6e95e4 100644 --- a/cmd/minikube/cmd/node_delete.go +++ b/cmd/minikube/cmd/node_delete.go @@ -50,7 +50,7 @@ var nodeDeleteCmd = &cobra.Command{ deletePossibleKicLeftOver(machineName, co.Config.Driver) } - out.Step(style.Deleted, false, "Node {{.name}} was successfully deleted.", out.V{"name": name}) + out.Step(style.Deleted, out.NoSpinner, "Node {{.name}} was successfully deleted.", out.V{"name": name}) }, } diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index fcd425d293a6..35afac696608 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -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, false, `For improved {{.driver}} performance, {{.fix}}`, out.V{"driver": driver.FullName(ds.Name), "fix": translate.T(st.Fix)}) + out.Step(style.Improvement, out.NoSpinner, `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, false, "Failed to verify '{{.driver_name}} info' will try again ...", out.V{"driver_name": drvName}) + out.Step(style.Confused, out.NoSpinner, "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, false, "Kubernetes {{.new}} is now available. If you would like to upgrade, specify: --kubernetes-version={{.prefix}}{{.new}}", out.V{"prefix": version.VersionPrefix, "new": defaultVersion}) + out.Step(style.New, out.NoSpinner, "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 8803d043d561..b10d98d54bf4 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, false, "Using image repository {{.name}}", out.V{"name": repository}) + out.Step(style.Success, out.NoSpinner, "Using image repository {{.name}}", out.V{"name": repository}) } // Backwards compatibility with --enable-default-cni diff --git a/pkg/addons/addons.go b/pkg/addons/addons.go index 791578d259a3..02cf1ae1f637 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, 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}) + out.Step(style.Tip, out.NoSpinner, `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, out.NoSpinner, `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, 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.") + out.Step(style.Notice, out.NoSpinner, "Your GCP credentials will now be mounted into every pod created in the {{.name}} cluster.", out.V{"name": cc.Name}) + out.Step(style.Notice, out.NoSpinner, "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, false, "Verifying {{.addon_name}} addon...", out.V{"addon_name": name}) + out.Step(style.HealthCheck, out.NoSpinner, "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, false, "Enabled addons: {{.addons}}", out.V{"addons": strings.Join(enabledAddons, ", ")}) + out.Step(style.AddonEnable, out.NoSpinner, "Enabled addons: {{.addons}}", out.V{"addons": strings.Join(enabledAddons, ", ")}) }() for _, a := range toEnableList { awg.Add(1) diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index 418e794c50aa..b592532a85ad 100644 --- a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go +++ b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go @@ -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, false, "Please free up disk or prune images.") + out.Step(style.Tip, out.NoSpinner, "Please free up disk or prune images.") if driver.IsVM(drv) { - out.Step(style.Stopped, false, "Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ") + out.Step(style.Stopped, out.NoSpinner, "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, false, "Please increse Desktop's disk size.") + out.Step(style.Stopped, out.NoSpinner, "Please increse Desktop's disk size.") if runtime.GOOS == "darwin" { - out.Step(style.Documentation, false, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) + out.Step(style.Documentation, out.NoSpinner, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) } if runtime.GOOS == "windows" { - out.Step(style.Documentation, false, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-windows/"}) + out.Step(style.Documentation, out.NoSpinner, "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, false, "Check if you have unnecessary pods running by running 'kubectl get po -A") + out.Step(style.Tip, out.NoSpinner, "Check if you have unnecessary pods running by running 'kubectl get po -A") if driver.IsVM(drv) { - out.Step(style.Stopped, false, "Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ") + out.Step(style.Stopped, out.NoSpinner, "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, false, "Consider increasing Docker Desktop's memory size.") + out.Step(style.Stopped, out.NoSpinner, "Consider increasing Docker Desktop's memory size.") if runtime.GOOS == "darwin" { - out.Step(style.Documentation, false, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) + out.Step(style.Documentation, out.NoSpinner, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) } if runtime.GOOS == "windows" { - out.Step(style.Documentation, false, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-windows/"}) + out.Step(style.Documentation, out.NoSpinner, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-windows/"}) } } out.ErrLn("") diff --git a/pkg/minikube/download/iso.go b/pkg/minikube/download/iso.go index 4a5e46e0e1be..d1d3a8e9a3bd 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, false, "Downloading VM boot image ...") + out.Step(style.ISODownload, out.NoSpinner, "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 7d907fbd4107..d15eeaa33bb4 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, false, "Downloading Kubernetes {{.version}} preload ...", out.V{"version": k8sVersion}) + out.Step(style.FileDownload, out.NoSpinner, "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 59ccaf6b64cd..c5a3d2c6cfc9 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, false, "The '{{.driver}}' driver requires elevated permissions. The following commands will be executed:\n\n{{ .example }}\n", out.V{"driver": name, "example": example.String()}) + out.Step(style.Permissions, out.NoSpinner, "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/out/out.go b/pkg/minikube/out/out.go index 691befd67210..6c17bc6f2734 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -102,7 +102,7 @@ func Step(st style.Enum, spinner bool, format string, a ...V) { // Infof is used for informational logs (options, env variables, etc) func Infof(format string, a ...V) { - outStyled := stylized(style.Option, useColor, false, format, a...) + outStyled := stylized(style.Option, useColor, NoSpinner, format, a...) if JSON { register.PrintInfo(outStyled) return @@ -193,7 +193,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, false, format, a...) + Step(style.Success, NoSpinner, format, a...) } // FatalT is a shortcut for writing a templated fatal message to stderr @@ -278,12 +278,12 @@ func LogEntries(msg string, err error, entries map[string][]string) { DisplayError(msg, err) for name, lines := range entries { - Step(style.Failure, false, "Problems detected in {{.entry}}:", V{"entry": name}) + Step(style.Failure, NoSpinner, "Problems detected in {{.entry}}:", V{"entry": name}) if len(lines) > MaxLogEntries { lines = lines[:MaxLogEntries] } for _, l := range lines { - Step(style.LogEntry, false, l) + Step(style.LogEntry, NoSpinner, l) } } } diff --git a/pkg/minikube/out/out_test.go b/pkg/minikube/out/out_test.go index ff5074036a89..8e3ea4c6c2d7 100644 --- a/pkg/minikube/out/out_test.go +++ b/pkg/minikube/out/out_test.go @@ -57,7 +57,7 @@ func TestOutT(t *testing.T) { os.Setenv(OverrideEnv, strconv.FormatBool(override)) f := tests.NewFakeFile() SetOutFile(f) - Step(tc.style, false, tc.message, tc.params) + Step(tc.style, NoSpinner, tc.message, tc.params) got := f.String() want := tc.wantASCII if override { From f729145c83c2ce36e3f385d0df888c4b69835cc7 Mon Sep 17 00:00:00 2001 From: alonyb Date: Wed, 9 Dec 2020 18:36:30 -0500 Subject: [PATCH 26/30] fix lint --- go.mod | 2 ++ pkg/minikube/out/out.go | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index db6549d05b2f..0ecc3be78e1a 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.15 require ( cloud.google.com/go/storage v1.10.0 + contrib.go.opencensus.io/exporter/stackdriver v0.12.1 github.com/Azure/azure-sdk-for-go v42.3.0+incompatible github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v0.13.0 github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 // indirect @@ -76,6 +77,7 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f github.com/zchee/go-vmnet v0.0.0-20161021174912-97ebf9174097 + go.opencensus.io v0.22.4 go.opentelemetry.io/otel v0.13.0 go.opentelemetry.io/otel/sdk v0.13.0 golang.org/x/build v0.0.0-20190927031335-2835ba2e683f diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go index 6c17bc6f2734..9280b66a40f7 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -66,9 +66,9 @@ var ( // MaxLogEntries controls the number of log entries to show for each source const ( - MaxLogEntries = 3 - Spinning = true - NoSpinner = false + MaxLogEntries = 3 + Spinning = true + NoSpinner = false SpinnerCharacter = 9 ) From 277e0961b15b77252be82bcfc3a81b1d1c43f259 Mon Sep 17 00:00:00 2001 From: alonyb Date: Thu, 10 Dec 2020 08:39:52 -0500 Subject: [PATCH 27/30] remove param && add spin bool to style enum --- cmd/minikube/cmd/config/addons_list.go | 2 +- cmd/minikube/cmd/config/disable.go | 2 +- cmd/minikube/cmd/config/enable.go | 6 ++-- cmd/minikube/cmd/config/open.go | 2 +- cmd/minikube/cmd/config/profile.go | 2 +- cmd/minikube/cmd/dashboard.go | 2 +- cmd/minikube/cmd/delete.go | 20 ++++++------- cmd/minikube/cmd/generate-docs.go | 2 +- cmd/minikube/cmd/mount.go | 12 ++++---- cmd/minikube/cmd/node_add.go | 4 +-- cmd/minikube/cmd/node_delete.go | 4 +-- cmd/minikube/cmd/node_start.go | 4 +-- cmd/minikube/cmd/node_stop.go | 2 +- cmd/minikube/cmd/pause.go | 6 ++-- cmd/minikube/cmd/service.go | 2 +- cmd/minikube/cmd/start.go | 30 ++++++++++---------- cmd/minikube/cmd/start_flags.go | 2 +- cmd/minikube/cmd/stop.go | 6 ++-- cmd/minikube/cmd/unpause.go | 6 ++-- cmd/minikube/cmd/update-context.go | 6 ++-- pkg/addons/addons.go | 12 ++++---- pkg/addons/gcpauth/enable.go | 2 +- pkg/minikube/bootstrapper/kubeadm/kubeadm.go | 24 ++++++++-------- pkg/minikube/browser/browser.go | 2 +- pkg/minikube/download/driver.go | 2 +- pkg/minikube/download/iso.go | 2 +- pkg/minikube/download/preload.go | 2 +- pkg/minikube/driver/install.go | 2 +- pkg/minikube/logs/logs.go | 8 +++--- pkg/minikube/machine/advice.go | 14 ++++----- pkg/minikube/machine/delete.go | 2 +- pkg/minikube/machine/fix.go | 10 +++---- pkg/minikube/machine/info.go | 2 +- pkg/minikube/machine/start.go | 6 ++-- pkg/minikube/machine/stop.go | 4 +-- pkg/minikube/mustload/mustload.go | 14 ++++----- pkg/minikube/node/cache.go | 6 ++-- pkg/minikube/node/config.go | 4 +-- pkg/minikube/node/start.go | 10 +++---- pkg/minikube/notify/notify.go | 4 +-- pkg/minikube/out/out.go | 20 ++++++------- pkg/minikube/out/out_style.go | 17 +++++------ pkg/minikube/out/out_test.go | 2 +- pkg/minikube/service/service.go | 2 +- pkg/minikube/style/style.go | 4 ++- pkg/minikube/tunnel/kic/ssh_conn.go | 8 +++--- 46 files changed, 154 insertions(+), 153 deletions(-) diff --git a/cmd/minikube/cmd/config/addons_list.go b/cmd/minikube/cmd/config/addons_list.go index c55f1c946c0a..7d88f1ca7d19 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, out.NoSpinner, "To see addons list for other profiles use: `minikube addons -p name list`") + out.Step(style.Tip, "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 67bada9d4ca8..198e8b88bddc 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, out.NoSpinner, `"The '{{.minikube_addon}}' addon is disabled`, out.V{"minikube_addon": addon}) + out.Step(style.AddonDisable, `"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 1ac81165e7a6..d16597f4bd2e 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, out.NoSpinner, "enable metrics-server addon instead of heapster addon because heapster is deprecated") + out.Step(style.Waiting, "enable metrics-server addon instead of heapster addon because heapster is deprecated") addon = "metrics-server" } err := addons.SetAndSave(ClusterFlagValue(), addon, "true") @@ -51,7 +51,7 @@ var addonsEnableCmd = &cobra.Command{ if ClusterFlagValue() != constants.DefaultClusterName { tipProfileArg = fmt.Sprintf(" -p %s", ClusterFlagValue()) } - out.Step(style.Tip, out.NoSpinner, `Some dashboard features require the metrics-server addon. To enable all features please run: + out.Step(style.Tip, `Some dashboard features require the metrics-server addon. To enable all features please run: minikube{{.profileArg}} addons enable metrics-server @@ -59,7 +59,7 @@ var addonsEnableCmd = &cobra.Command{ } - out.Step(style.AddonEnable, out.NoSpinner, "The '{{.addonName}}' addon is enabled", out.V{"addonName": addon}) + out.Step(style.AddonEnable, "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 79edbf090234..596379e83ff3 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, out.NoSpinner, "Opening Kubernetes service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc}) + out.Step(style.Celebrate, "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 bf56708198ac..1e56e4cfb2f8 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, out.NoSpinner, profile) + out.Step(style.Empty, profile) os.Exit(0) } diff --git a/cmd/minikube/cmd/dashboard.go b/cmd/minikube/cmd/dashboard.go index eb3b3cc89ee6..b999ac642039 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, out.NoSpinner, "Opening {{.url}} in your default browser...", out.V{"url": url}) + out.Step(style.Celebrate, "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 261e4fa2e94b..8ce08f8d8582 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, out.NoSpinner, " - {{.profile}}", out.V{"profile": p.Name}) + out.Step(style.Notice, " - {{.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, out.NoSpinner, "Successfully deleted all profiles") + out.Step(style.DeletingHost, "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, out.NoSpinner, "Successfully purged minikube directory located at - [{{.minikubeDirectory}}]", out.V{"minikubeDirectory": localpath.MiniPath()}) + out.Step(style.Deleted, "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, out.NoSpinner, `Deleting container "{{.name}}" ...`, out.V{"name": cname}) + out.Step(style.DeletingHost, `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, out.NoSpinner, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, out.V{"profile_name": profile.Name, "driver_name": profile.Config.Driver}) + out.Step(style.DeletingHost, `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, out.NoSpinner, `Removed all traces of the "{{.name}}" cluster.`, out.V{"name": profile.Name}) + out.Step(style.Deleted, `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, out.NoSpinner, `You may need to manually remove the "{{.name}}" VM from your hypervisor`, out.V{"name": machineName}) + out.Step(style.Notice, `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, out.NoSpinner, "Trying to delete invalid profile {{.profile}}", out.V{"profile": profile.Name}) + out.Step(style.DeletingHost, "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, out.NoSpinner, "Uninstalling Kubernetes {{.kubernetes_version}} using {{.bootstrapper_name}} ...", out.V{"kubernetes_version": cc.KubernetesConfig.KubernetesVersion, "bootstrapper_name": bsName}) + out.Step(style.Resetting, "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, out.NoSpinner, `Removing {{.directory}} ...`, out.V{"directory": machineDir}) + out.Step(style.DeletingHost, `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 e944d8706024..046b29ca5b05 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, out.NoSpinner, "Docs have been saved at - {{.path}}", out.V{"path": path}) + out.Step(style.Documentation, "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 486dd9ed0d17..f61e2c3736ff 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, out.NoSpinner, "Mounting host path {{.sourcePath}} into VM as {{.destinationPath}} ...", out.V{"sourcePath": hostPath, "destinationPath": vmPath}) + out.Step(style.Mounting, "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, out.NoSpinner, "Userspace file server: ") + out.Step(style.Fileserver, "Userspace file server: ") ufs.StartServer(net.JoinHostPort(bindIP, strconv.Itoa(port)), debugVal, hostPath) - out.Step(style.Stopped, out.NoSpinner, "Userspace file server is shutdown") + out.Step(style.Stopped, "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, out.NoSpinner, "Unmounting {{.path}} ...", out.V{"path": vmPath}) + out.Step(style.Unmount, "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, out.NoSpinner, "Successfully mounted {{.sourcePath}} to {{.destinationPath}}", out.V{"sourcePath": hostPath, "destinationPath": vmPath}) + out.Step(style.Success, "Successfully mounted {{.sourcePath}} to {{.destinationPath}}", out.V{"sourcePath": hostPath, "destinationPath": vmPath}) out.Ln("") - out.Step(style.Notice, out.NoSpinner, "NOTE: This process must stay alive for the mount to be accessible ...") + out.Step(style.Notice, "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 4259573f25cc..5121fb1affe2 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, out.NoSpinner, "Adding node {{.name}} to cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name}) + out.Step(style.Happy, "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, out.NoSpinner, "Successfully added {{.name}} to {{.cluster}}!", out.V{"name": name, "cluster": cc.Name}) + out.Step(style.Ready, "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 ed511a6e95e4..ae04fab410e0 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, out.NoSpinner, "Deleting node {{.name}} from cluster {{.cluster}}", out.V{"name": name, "cluster": co.Config.Name}) + out.Step(style.DeletingHost, "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, out.NoSpinner, "Node {{.name}} was successfully deleted.", out.V{"name": name}) + out.Step(style.Deleted, "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 ae2bca54c055..e80964433e39 100644 --- a/cmd/minikube/cmd/node_start.go +++ b/cmd/minikube/cmd/node_start.go @@ -51,7 +51,7 @@ var nodeStartCmd = &cobra.Command{ machineName := driver.MachineName(*cc, *n) if machine.IsRunning(api, machineName) { - out.Step(style.Check, out.NoSpinner, "{{.name}} is already running", out.V{"name": name}) + out.Step(style.Check, "{{.name}} is already running", out.V{"name": name}) os.Exit(0) } @@ -79,7 +79,7 @@ var nodeStartCmd = &cobra.Command{ exit.Error(reason.GuestNodeStart, "failed to start node", err) } } - out.Step(style.Happy, out.NoSpinner, "Successfully started node {{.name}}!", out.V{"name": machineName}) + out.Step(style.Happy, "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 406f25da248f..db718f311e01 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, out.NoSpinner, "Successfully stopped node {{.name}}", out.V{"name": machineName}) + out.Step(style.Stopped, "Successfully stopped node {{.name}}", out.V{"name": machineName}) }, } diff --git a/cmd/minikube/cmd/pause.go b/cmd/minikube/cmd/pause.go index 2b14ba076cf1..858d3bef7d9e 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, out.NoSpinner, "Pausing node {{.name}} ... ", out.V{"name": name}) + out.Step(style.Pause, "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, out.NoSpinner, "Paused {{.count}} containers", out.V{"count": len(ids)}) + out.Step(style.Unpause, "Paused {{.count}} containers", out.V{"count": len(ids)}) } else { - out.Step(style.Unpause, out.NoSpinner, "Paused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")}) + out.Step(style.Unpause, "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 c1da80aa6e66..75342c4caa32 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, out.NoSpinner, "Opening service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc}) + out.Step(style.Celebrate, "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 35afac696608..aad4cdc4e4d0 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, out.NoSpinner, `dry-run validation complete!`) + out.Step(style.DryRun, `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, out.NoSpinner, "To track progress on multi-node clusters, see https://github.com/kubernetes/minikube/issues/7538.") + out.Step(style.Documentation, "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, out.NoSpinner, "{{.prefix}}minikube {{.version}} on {{.platform}}", out.V{"prefix": prefix, "version": version, "platform": platform()}) + out.Step(style.Happy, "{{.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, out.NoSpinner, "To connect to this cluster, use: --context={{.name}}", out.V{"name": kcs.ClusterName}) + out.Step(style.Kubectl, "To connect to this cluster, use: --context={{.name}}", out.V{"name": kcs.ClusterName}) } else { - out.Step(style.Ready, out.NoSpinner, `Done! kubectl is now configured to use "{{.name}}" cluster and "{{.ns}}" namespace by default`, out.V{"name": machineName, "ns": kcs.Namespace}) + out.Step(style.Ready, `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, out.NoSpinner, "kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'") + out.Step(style.Tip, "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, out.NoSpinner, `Using the {{.driver}} driver based on existing profile`, out.V{"driver": ds.String()}) + out.Step(style.Sparkle, `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, out.NoSpinner, `Using the {{.driver}} driver based on user configuration`, out.V{"driver": ds.String()}) + out.Step(style.Sparkle, `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, out.NoSpinner, `Using the {{.driver}} driver based on user configuration`, out.V{"driver": ds.String()}) + out.Step(style.Sparkle, `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, out.NoSpinner, "Unable to pick a default driver. Here is what was considered, in preference order:") + out.Step(style.ThumbsDown, "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, out.NoSpinner, `Automatically selected the {{.driver}} driver. Other choices: {{.alternates}}`, out.V{"driver": pick.Name, "alternates": strings.Join(altNames, ", ")}) + out.Step(style.Sparkle, `Automatically selected the {{.driver}} driver. Other choices: {{.alternates}}`, out.V{"driver": pick.Name, "alternates": strings.Join(altNames, ", ")}) } else { - out.Step(style.Sparkle, out.NoSpinner, `Automatically selected the {{.driver}} driver`, out.V{"driver": pick.String()}) + out.Step(style.Sparkle, `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, out.NoSpinner, `For improved {{.driver}} performance, {{.fix}}`, out.V{"driver": driver.FullName(ds.Name), "fix": translate.T(st.Fix)}) + out.Step(style.Improvement, `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, out.NoSpinner, "Failed to verify '{{.driver_name}} info' will try again ...", out.V{"driver_name": drvName}) + out.Step(style.Confused, "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, out.NoSpinner, "Kubernetes {{.new}} is now available. If you would like to upgrade, specify: --kubernetes-version={{.prefix}}{{.new}}", out.V{"prefix": version.VersionPrefix, "new": defaultVersion}) + out.Step(style.New, "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 b10d98d54bf4..11d0a4dbb051 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, out.NoSpinner, "Using image repository {{.name}}", out.V{"name": repository}) + out.Step(style.Success, "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 8c8b3ba4f353..4fd0fadabc49 100644 --- a/cmd/minikube/cmd/stop.go +++ b/cmd/minikube/cmd/stop.go @@ -102,7 +102,7 @@ func runStop(cmd *cobra.Command, args []string) { schedule.KillExisting(profilesToStop) if cancelScheduledStop { register.Reg.SetStep(register.Done) - out.Step(style.Stopped, out.NoSpinner, `All existing scheduled stops cancelled`) + out.Step(style.Stopped, `All existing scheduled stops cancelled`) return } @@ -125,7 +125,7 @@ func runStop(cmd *cobra.Command, args []string) { register.Reg.SetStep(register.Done) if stoppedNodes > 0 { - out.Step(style.Stopped, out.NoSpinner, `{{.count}} nodes stopped.`, out.V{"count": stoppedNodes}) + out.Step(style.Stopped, `{{.count}} nodes stopped.`, out.V{"count": stoppedNodes}) } } @@ -171,7 +171,7 @@ func stop(api libmachine.API, machineName string) bool { switch err := errors.Cause(err).(type) { case mcnerror.ErrHostDoesNotExist: - out.Step(style.Meh, out.NoSpinner, `"{{.machineName}}" does not exist, nothing to stop`, out.V{"machineName": machineName}) + out.Step(style.Meh, `"{{.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 5bb71851c89e..3bf538c8f591 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, out.NoSpinner, "Unpausing node {{.name}} ... ", out.V{"name": name}) + out.Step(style.Pause, "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, out.NoSpinner, "Unpaused {{.count}} containers", out.V{"count": len(ids)}) + out.Step(style.Pause, "Unpaused {{.count}} containers", out.V{"count": len(ids)}) } else { - out.Step(style.Pause, out.NoSpinner, "Unpaused {{.count}} containers in: {{.namespaces}}", out.V{"count": len(ids), "namespaces": strings.Join(namespaces, ", ")}) + out.Step(style.Pause, "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 afb0d7bdad8d..709a65ad61cd 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, out.NoSpinner, `"{{.context}}" context has been updated to point to {{.hostname}}:{{.port}}`, out.V{"context": cname, "hostname": co.CP.Hostname, "port": co.CP.Port}) + out.Step(style.Celebrate, `"{{.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, out.NoSpinner, `No changes required for the "{{.context}}" context`, out.V{"context": cname}) + out.Step(style.Meh, `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, out.NoSpinner, `Current context is "{{.context}}"`, out.V{"context": cname}) + out.Step(style.Kubectl, `Current context is "{{.context}}"`, out.V{"context": cname}) } }, } diff --git a/pkg/addons/addons.go b/pkg/addons/addons.go index 02cf1ae1f637..12e80fabd58f 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, out.NoSpinner, `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, out.NoSpinner, `For more information see: https://minikube.sigs.k8s.io/docs/drivers/{{.driver}}`, out.V{"driver": cc.Driver}) + out.Step(style.Tip, `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, `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, out.NoSpinner, "Your GCP credentials will now be mounted into every pod created in the {{.name}} cluster.", out.V{"name": cc.Name}) - out.Step(style.Notice, out.NoSpinner, "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.") + out.Step(style.Notice, "Your GCP credentials will now be mounted into every pod created in the {{.name}} cluster.", 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.") } 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, out.NoSpinner, "Verifying {{.addon_name}} addon...", out.V{"addon_name": name}) + out.Step(style.HealthCheck, "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, out.NoSpinner, "Enabled addons: {{.addons}}", out.V{"addons": strings.Join(enabledAddons, ", ")}) + out.Step(style.AddonEnable, "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 7d0d362b5eab..f0adb3c9f5e7 100644 --- a/pkg/addons/gcpauth/enable.go +++ b/pkg/addons/gcpauth/enable.go @@ -103,7 +103,7 @@ func enableAddon(cfg *config.ClusterConfig) error { } out.WarningT("Could not determine a Google Cloud project, which might be ok.") - out.Step(style.Tip, out.NoSpinner, `To set your Google Cloud project, run: + out.Step(style.Tip, `To set your Google Cloud project, run: gcloud config set project diff --git a/pkg/minikube/bootstrapper/kubeadm/kubeadm.go b/pkg/minikube/bootstrapper/kubeadm/kubeadm.go index b592532a85ad..a85c04402431 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, out.NoSpinner, "Configuring {{.name}} (Container Networking Interface) ...", out.V{"name": cnm.String()}) + out.Step(style.CNI, "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, out.NoSpinner, "Verifying Kubernetes components...") + out.Step(style.HealthCheck, "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, out.NoSpinner, "Please free up disk or prune images.") + out.Step(style.Tip, "Please free up disk or prune images.") if driver.IsVM(drv) { - out.Step(style.Stopped, out.NoSpinner, "Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ") + out.Step(style.Stopped, "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, out.NoSpinner, "Please increse Desktop's disk size.") + out.Step(style.Stopped, "Please increse Desktop's disk size.") if runtime.GOOS == "darwin" { - out.Step(style.Documentation, out.NoSpinner, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) + out.Step(style.Documentation, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) } if runtime.GOOS == "windows" { - out.Step(style.Documentation, out.NoSpinner, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-windows/"}) + out.Step(style.Documentation, "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, out.NoSpinner, "Check if you have unnecessary pods running by running 'kubectl get po -A") + out.Step(style.Tip, "Check if you have unnecessary pods running by running 'kubectl get po -A") if driver.IsVM(drv) { - out.Step(style.Stopped, out.NoSpinner, "Consider creating a cluster with larger memory size using `minikube start --memory SIZE_MB` ") + out.Step(style.Stopped, "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, out.NoSpinner, "Consider increasing Docker Desktop's memory size.") + out.Step(style.Stopped, "Consider increasing Docker Desktop's memory size.") if runtime.GOOS == "darwin" { - out.Step(style.Documentation, out.NoSpinner, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) + out.Step(style.Documentation, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-mac/space/"}) } if runtime.GOOS == "windows" { - out.Step(style.Documentation, out.NoSpinner, "Documentation: {{.url}}", out.V{"url": "https://docs.docker.com/docker-for-windows/"}) + out.Step(style.Documentation, "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 f6509ca9344b..099eb8adcbc2 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, out.NoSpinner, url) + out.Step(style.URL, url) return nil } } diff --git a/pkg/minikube/download/driver.go b/pkg/minikube/download/driver.go index db4df6f4d1d9..2a3f12194980 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, out.NoSpinner, "Downloading driver {{.driver}}:", out.V{"driver": name}) + out.Step(style.FileDownload, "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 d1d3a8e9a3bd..549cb055b35d 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, out.NoSpinner, "Downloading VM boot image ...") + out.Step(style.ISODownload, "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 d15eeaa33bb4..713495b327bd 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, out.NoSpinner, "Downloading Kubernetes {{.version}} preload ...", out.V{"version": k8sVersion}) + out.Step(style.FileDownload, "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 c5a3d2c6cfc9..ffec3a951e4f 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, out.NoSpinner, "The '{{.driver}}' driver requires elevated permissions. The following commands will be executed:\n\n{{ .example }}\n", out.V{"driver": name, "example": example.String()}) + out.Step(style.Permissions, "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 afb011913ace..43b4c08e6722 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, out.NoSpinner, l) + out.Step(style.LogEntry, 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, out.NoSpinner, "") + out.Step(style.Empty, "") } - out.Step(style.Empty, out.NoSpinner, "==> {{.name}} <==", out.V{"name": name}) + out.Step(style.Empty, "==> {{.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, out.NoSpinner, scanner.Text()) + out.Step(style.Empty, scanner.Text()) } } diff --git a/pkg/minikube/machine/advice.go b/pkg/minikube/machine/advice.go index 8ad0150b6c01..d9ea37b175cd 100644 --- a/pkg/minikube/machine/advice.go +++ b/pkg/minikube/machine/advice.go @@ -38,29 +38,29 @@ func MaybeDisplayAdvice(err error, driver string) { } if errors.Is(err, oci.ErrExitedUnexpectedly) || errors.Is(err, oci.ErrDaemonInfo) { - out.Step(style.Tip, out.NoSpinner, "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}) + 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:", out.V{"driver_name": driver}) if driver == oci.Docker || driver == oci.Podman { out.String("\n\t") - out.Step(style.Empty, out.NoSpinner, `- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers. + out.Step(style.Empty, `- Prune unused {{.driver_name}} images, volumes, networks and abandoned containers. {{.driver_name}} system prune --volumes`, out.V{"driver_name": driver}) } out.String("\n\t") - out.Step(style.Empty, out.NoSpinner, `- Restart your {{.driver_name}} service`, out.V{"driver_name": driver}) + out.Step(style.Empty, `- Restart your {{.driver_name}} service`, out.V{"driver_name": driver}) if runtime.GOOS != "linux" { out.String("\n\t") - out.Step(style.Empty, out.NoSpinner, `- Ensure your {{.driver_name}} daemon has access to enough CPU/memory resources.`, out.V{"driver_name": driver}) + out.Step(style.Empty, `- 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") - out.Step(style.Empty, out.NoSpinner, `- Docs https://docs.docker.com/docker-for-mac/#resources`, out.V{"driver_name": driver}) + out.Step(style.Empty, `- 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") - out.Step(style.Empty, out.NoSpinner, `- Docs https://docs.docker.com/docker-for-windows/#resources`, out.V{"driver_name": driver}) + out.Step(style.Empty, `- Docs https://docs.docker.com/docker-for-windows/#resources`, out.V{"driver_name": driver}) } } out.String("\n\t") - out.Step(style.Empty, out.NoSpinner, `- Delete and recreate minikube cluster + out.Step(style.Empty, `- Delete and recreate minikube cluster minikube delete 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 cd1133d9a937..636c5bc729bf 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, out.NoSpinner, `Deleting "{{.profile_name}}" in {{.driver_name}} ...`, out.V{"profile_name": machineName, "driver_name": host.DriverName}) + out.Step(style.DeletingHost, `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 c25350a2c419..8e0eeb7f77e4 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, out.NoSpinner, `{{.driver_name}} "{{.cluster}}" {{.machine_type}} is missing, will recreate.`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + out.Step(style.Shrug, `{{.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, out.NoSpinner, `Updating the running {{.driver_name}} "{{.cluster}}" {{.machine_type}} ...`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + out.Step(style.Running, `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, out.NoSpinner, `Restarting existing {{.driver_name}} {{.machine_type}} for "{{.cluster}}" ...`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + out.Step(style.Restarting, `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, out.NoSpinner, "Noticed you have an activated docker-env on {{.driver_name}} driver in this terminal:", out.V{"driver_name": drver}) + out.Step(style.Notice, "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, out.NoSpinner, "Noticed you have an activated podman-env on {{.driver_name}} driver in this terminal:", out.V{"driver_name": drver}) + out.Step(style.Notice, "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 fb95a2158f1a..d2f3066a7ed7 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, out.NoSpinner, "OS release is {{.pretty_name}}", out.V{"pretty_name": osReleaseInfo.PrettyName}) + out.Step(style.Provisioner, "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 3dd4ec499f57..9314ec703a4a 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, out.NoSpinner, "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}) + out.Step(style.StartingNone, "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, out.NoSpinner, "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}) + out.Step(style.StartingVM, "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, out.NoSpinner, "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}) + out.Step(style.StartingVM, "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 9642992ce01a..3984f2e9aa0e 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, out.NoSpinner, `Stopping node "{{.name}}" ...`, out.V{"name": machineName}) + out.Step(style.Stopping, `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, out.NoSpinner, `Powering off "{{.profile_name}}" via SSH ...`, out.V{"profile_name": h.Name}) + out.Step(style.Shutdown, `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 109e91441723..d3e67adcc40f 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, out.NoSpinner, `Profile "{{.cluster}}" not found. Run "minikube profile list" to view all profiles.`, out.V{"cluster": name}) + out.Step(style.Shrug, `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, out.NoSpinner, `The control plane node "{{.name}}" does not exist.`, out.V{"name": cp.Name}) + out.Step(style.Shrug, `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, out.NoSpinner, `The control plane node must be running for this command`) + out.Step(style.Shrug, `The control plane node must be running for this command`) exitTip("start", name, reason.ExGuestUnavailable) } if hs != state.Running.String() { - out.Step(style.Shrug, out.NoSpinner, `The control plane node is not running (state={{.state}})`, out.V{"name": cp.Name, "state": hs}) + out.Step(style.Shrug, `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, out.NoSpinner, `The control plane for "{{.name}}" is paused!`, out.V{"name": name}) + out.Step(style.Shrug, `The control plane for "{{.name}}" is paused!`, out.V{"name": name}) exitTip("unpause", name, reason.ExSvcConfig) } if as != state.Running { - out.Step(style.Shrug, out.NoSpinner, `This control plane is not running! (state={{.state}})`, out.V{"state": as.String()}) + out.Step(style.Shrug, `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, out.NoSpinner, `To start a cluster, run: "{{.command}}"`, out.V{"command": command}) + out.Step(style.Workaround, `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 b95d2823a500..e775ed3ca104 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, out.NoSpinner, "Download complete!") + out.Step(style.Check, "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, out.NoSpinner, "Pulling base image ...") + out.Step(style.Pulling, "Pulling base image ...") g.Go(func() error { baseImg := cc.KicBaseImage if baseImg == kic.BaseImage && len(cc.KubernetesConfig.ImageRepository) != 0 { @@ -170,7 +170,7 @@ 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, out.NoSpinner, `Please visit the following link for documentation around this: + out.Step(style.Documentation, `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 `) } diff --git a/pkg/minikube/node/config.go b/pkg/minikube/node/config.go index 36e013f2662f..2a492c4ff8fc 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(), out.Spinning, "Preparing Kubernetes {{.k8sVersion}} on {{.runtime}} {{.runtimeVersion}} ...", out.V{"k8sVersion": k8sVersion, "runtime": cr.Name(), "runtimeVersion": version}) + out.Step(cr.Style(),"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, out.NoSpinner, "Creating mount {{.name}} ...", out.V{"name": viper.GetString(mountString)}) + out.Step(style.Mounting, "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 ef9ddb7e3eb5..5995270aab68 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, out.NoSpinner, "Starting control plane node {{.name}} in cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name}) + out.Step(style.ThumbsUp, "Starting control plane node {{.name}} in cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name}) } else { - out.Step(style.ThumbsUp, out.NoSpinner, "Starting node {{.name}} in cluster {{.cluster}}", out.V{"name": name, "cluster": cc.Name}) + out.Step(style.ThumbsUp, "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, out.NoSpinner, "Found network options:") + out.Step(style.Internet, "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, out.NoSpinner, "Please see {{.documentation_url}} for more details", out.V{"documentation_url": "https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/"}) + out.Step(style.Documentation, "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, out.NoSpinner, "Configuring local host environment ...") + out.Step(style.StartingNone, "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 89cd3182e72b..f9740236f786 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, out.NoSpinner, `minikube {{.version}} is available! Download it: {{.url}}`, out.V{"version": latestVersion, "url": url}) - out.Step(style.Tip, out.NoSpinner, "To disable this notice, run: 'minikube config set WantUpdateNotification false'\n") + out.Step(style.Celebrate, `minikube {{.version}} is available! Download it: {{.url}}`, out.V{"version": latestVersion, "url": url}) + out.Step(style.Tip, "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 9280b66a40f7..71893b30d42f 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -67,8 +67,6 @@ var ( // MaxLogEntries controls the number of log entries to show for each source const ( MaxLogEntries = 3 - Spinning = true - NoSpinner = false SpinnerCharacter = 9 ) @@ -82,12 +80,12 @@ type fdWriter interface { type V map[string]interface{} // Step writes a stylized and templated message to stdout -func Step(st style.Enum, spinner bool, format string, a ...V) { +func Step(st style.Enum, format string, a ...V) { if st == style.Option { Infof(format, a...) return } - outStyled := stylized(st, useColor, spinner, format, a...) + outStyled, spinner := stylized(st, useColor, format, a...) if JSON { register.PrintStep(outStyled) return @@ -102,7 +100,7 @@ func Step(st style.Enum, spinner bool, format string, a ...V) { // Infof is used for informational logs (options, env variables, etc) func Infof(format string, a ...V) { - outStyled := stylized(style.Option, useColor, NoSpinner, format, a...) + outStyled, _ := stylized(style.Option, useColor, format, a...) if JSON { register.PrintInfo(outStyled) return @@ -119,7 +117,6 @@ func String(format string, a ...interface{}) { klog.Warningf("[unset outFile]: %s", fmt.Sprintf(format, a...)) return } - klog.Infof(format, a...) // if spin is active from a previous step, it will stop spinner displaying if spin.Active() { @@ -161,7 +158,7 @@ func Ln(format string, a ...interface{}) { // ErrT writes a stylized and templated error message to stderr func ErrT(st style.Enum, format string, a ...V) { - errStyled := stylized(st, useColor, false, format, a...) + errStyled, _ := stylized(st, useColor, format, a...) Err(errStyled) } @@ -193,7 +190,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, NoSpinner, format, a...) + Step(style.Success, format, a...) } // FatalT is a shortcut for writing a templated fatal message to stderr @@ -204,7 +201,8 @@ func FatalT(format string, a ...V) { // WarningT is a shortcut for writing a templated warning message to stderr func WarningT(format string, a ...V) { if JSON { - register.PrintWarning(stylized(style.Warning, useColor, false, format, a...)) + st, _ := stylized(style.Warning, useColor, format, a...) + register.PrintWarning(st) return } ErrT(style.Warning, format, a...) @@ -278,12 +276,12 @@ func LogEntries(msg string, err error, entries map[string][]string) { DisplayError(msg, err) for name, lines := range entries { - Step(style.Failure, NoSpinner, "Problems detected in {{.entry}}:", V{"entry": name}) + Step(style.Failure, "Problems detected in {{.entry}}:", V{"entry": name}) if len(lines) > MaxLogEntries { lines = lines[:MaxLogEntries] } for _, l := range lines { - Step(style.LogEntry, NoSpinner, l) + Step(style.LogEntry, l) } } } diff --git a/pkg/minikube/out/out_style.go b/pkg/minikube/out/out_style.go index eef867fc99b0..6bcc6a16e454 100644 --- a/pkg/minikube/out/out_style.go +++ b/pkg/minikube/out/out_style.go @@ -31,30 +31,31 @@ func applyPrefix(prefix, format string) string { } // applyStyle translates the given string if necessary then adds any appropriate style prefix. -func applyStyle(st style.Enum, useColor bool, format string, spinner bool) string { +func applyStyle(st style.Enum, useColor bool, format string) (string, bool) { format = translate.T(format) s, ok := style.Config[st] - if !s.OmitNewline && !spinner { + if !s.OmitNewline { format += "\n" } // Similar to CSS styles, if no style matches, output an unformatted string. if !ok || JSON { - return format + return format, s.Spinner } if !useColor { - return applyPrefix(style.LowPrefix(s), format) + return applyPrefix(style.LowPrefix(s), format), s.Spinner } - return applyPrefix(s.Prefix, format) + return applyPrefix(s.Prefix, format), s.Spinner } // stylized applies formatting to the provided template -func stylized(st style.Enum, useColor bool, spinner bool, format string, a ...V) string { +func stylized(st style.Enum, useColor bool, format string, a ...V) (string, bool) { + var spinner bool if a == nil { a = []V{{}} } - format = applyStyle(st, useColor, format, spinner) - return Fmt(format, a...) + format, spinner = applyStyle(st, useColor, format) + return Fmt(format, a...), spinner } diff --git a/pkg/minikube/out/out_test.go b/pkg/minikube/out/out_test.go index 8e3ea4c6c2d7..9094be289c72 100644 --- a/pkg/minikube/out/out_test.go +++ b/pkg/minikube/out/out_test.go @@ -57,7 +57,7 @@ func TestOutT(t *testing.T) { os.Setenv(OverrideEnv, strconv.FormatBool(override)) f := tests.NewFakeFile() SetOutFile(f) - Step(tc.style, NoSpinner, tc.message, tc.params) + Step(tc.style, tc.message, tc.params) got := f.String() want := tc.wantASCII if override { diff --git a/pkg/minikube/service/service.go b/pkg/minikube/service/service.go index 8a999d5c2a88..091158a3c7c4 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, out.NoSpinner, "service {{.namespace_name}}/{{.service_name}} has no node port", out.V{"namespace_name": namespace, "service_name": service}) + out.Step(style.Sad, "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/style/style.go b/pkg/minikube/style/style.go index cc722796b056..73bf36fb44b3 100644 --- a/pkg/minikube/style/style.go +++ b/pkg/minikube/style/style.go @@ -41,6 +41,8 @@ type Options struct { LowPrefix string // OmitNewline omits a newline at the end of a message. OmitNewline bool + // Spinner is a character to place at ending of message + Spinner bool } // Config is a map of style name to style struct @@ -104,7 +106,7 @@ var Config = map[Enum]Options{ Copying: {Prefix: "✨ "}, CRIO: {Prefix: "🎁 "}, // This should be a snow-flake, but the emoji has a strange width on macOS DeletingHost: {Prefix: "🔥 "}, - Docker: {Prefix: "🐳 "}, + Docker: {Prefix: "🐳 ", OmitNewline: true, Spinner: true}, DryRun: {Prefix: "🌵 "}, Enabling: {Prefix: "🔌 "}, FileDownload: {Prefix: "💾 "}, diff --git a/pkg/minikube/tunnel/kic/ssh_conn.go b/pkg/minikube/tunnel/kic/ssh_conn.go index 390b7526e14a..d850e92bef6a 100644 --- a/pkg/minikube/tunnel/kic/ssh_conn.go +++ b/pkg/minikube/tunnel/kic/ssh_conn.go @@ -69,12 +69,12 @@ func createSSHConn(name, sshPort, sshKey string, svc *v1.Service) *sshConn { if askForSudo { out.Step( - style.Warning, out.NoSpinner, + style.Warning, "The service {{.service}} requires privileged ports to be exposed: {{.ports}}", out.V{"service": svc.Name, "ports": fmt.Sprintf("%v", privilegedPorts)}, ) - out.Step(style.Permissions, out.NoSpinner, "sudo permission will be asked for it.") + out.Step(style.Permissions, "sudo permission will be asked for it.") command = "sudo" sshArgs = append([]string{"ssh"}, sshArgs...) @@ -131,7 +131,7 @@ func createSSHConnWithRandomPorts(name, sshPort, sshKey string, svc *v1.Service) } func (c *sshConn) startAndWait() error { - out.Step(style.Running, out.NoSpinner, "Starting tunnel for service {{.service}}.", out.V{"service": c.service}) + out.Step(style.Running, "Starting tunnel for service {{.service}}.", out.V{"service": c.service}) err := c.cmd.Start() if err != nil { @@ -145,7 +145,7 @@ func (c *sshConn) startAndWait() error { } func (c *sshConn) stop() error { - out.Step(style.Stopping, out.NoSpinner, "Stopping tunnel for service {{.service}}.", out.V{"service": c.service}) + out.Step(style.Stopping, "Stopping tunnel for service {{.service}}.", out.V{"service": c.service}) return c.cmd.Process.Kill() } From d47405830c5e04f1ea27427bf2476a76d71a0d7d Mon Sep 17 00:00:00 2001 From: alonyb Date: Thu, 10 Dec 2020 08:46:20 -0500 Subject: [PATCH 28/30] restore unittest --- pkg/minikube/node/config.go | 2 +- pkg/minikube/out/out_style_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/minikube/node/config.go b/pkg/minikube/node/config.go index 2a492c4ff8fc..5d3d926e7393 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}} ...", out.V{"k8sVersion": k8sVersion, "runtime": cr.Name(), "runtimeVersion": version}) + out.Step(cr.Style(), "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}) } diff --git a/pkg/minikube/out/out_style_test.go b/pkg/minikube/out/out_style_test.go index 897513be629e..66491fd6ec05 100644 --- a/pkg/minikube/out/out_style_test.go +++ b/pkg/minikube/out/out_style_test.go @@ -83,7 +83,7 @@ func TestApplyStyle(t *testing.T) { } for _, test := range tests { t.Run(test.description, func(t *testing.T) { - rawGot := applyStyle(test.styleEnum, test.useColor, test.format, false) + rawGot, _ := applyStyle(test.styleEnum, test.useColor, test.format) got := strings.TrimSpace(rawGot) if got != test.expected { t.Errorf("Expected '%v' but got '%v'", test.expected, got) @@ -139,7 +139,7 @@ func TestApplyTemplateFormating(t *testing.T) { } for _, test := range tests { t.Run(test.description, func(t *testing.T) { - rawGot := stylized(test.styleEnum, test.useColor, false, test.format, test.a...) + rawGot, _ := stylized(test.styleEnum, test.useColor, test.format, test.a...) got := strings.TrimSpace(rawGot) if got != test.expected { t.Errorf("Expected '%v' but got '%v'", test.expected, got) From 8ee898976a5bf0e57d38f176e96af5be5aaf8209 Mon Sep 17 00:00:00 2001 From: alonyb Date: Thu, 10 Dec 2020 09:12:24 -0500 Subject: [PATCH 29/30] move spinner character const to style --- pkg/minikube/out/out.go | 3 +-- pkg/minikube/style/style.go | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go index 71893b30d42f..3b883977a69c 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -61,13 +61,12 @@ var ( // JSON is whether or not we should output stdout in JSON format. Set using SetJSON() JSON = false // spin is spinner showed at starting minikube - spin = spinner.New(spinner.CharSets[SpinnerCharacter], 100*time.Millisecond) + spin = spinner.New(spinner.CharSets[style.SpinnerCharacter], 100*time.Millisecond) ) // MaxLogEntries controls the number of log entries to show for each source const ( MaxLogEntries = 3 - SpinnerCharacter = 9 ) // fdWriter is the subset of file.File that implements io.Writer and Fd() diff --git a/pkg/minikube/style/style.go b/pkg/minikube/style/style.go index 73bf36fb44b3..4bd9eaaf3209 100644 --- a/pkg/minikube/style/style.go +++ b/pkg/minikube/style/style.go @@ -45,6 +45,8 @@ type Options struct { Spinner bool } +const SpinnerCharacter = 9 + // Config is a map of style name to style struct // For consistency, ensure that emojis added render with the same width across platforms. var Config = map[Enum]Options{ From 2d80cfcdb06a2609d460469a5548bf9f8f8200b5 Mon Sep 17 00:00:00 2001 From: alonyb Date: Thu, 10 Dec 2020 09:37:50 -0500 Subject: [PATCH 30/30] fix lint --- pkg/minikube/out/out.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go index 3b883977a69c..df6cadc156ad 100644 --- a/pkg/minikube/out/out.go +++ b/pkg/minikube/out/out.go @@ -66,7 +66,7 @@ var ( // MaxLogEntries controls the number of log entries to show for each source const ( - MaxLogEntries = 3 + MaxLogEntries = 3 ) // fdWriter is the subset of file.File that implements io.Writer and Fd()