Merge pull request #5241 from Zyqsempai/5114-warning-to-stderr-on-minikube-start

Moved warning to minikube start command and print it to stderr
pull/5253/head
Sharif Elgamal 2019-09-03 12:28:54 -07:00 committed by GitHub
commit 5c8afbb012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 17 deletions

View File

@ -37,7 +37,6 @@ import (
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/notify"
"k8s.io/minikube/pkg/minikube/translate"
)
@ -53,10 +52,6 @@ var dirs = [...]string{
constants.MakeMiniPath("logs"),
}
var (
enableUpdateNotification = true
)
var viperWhiteList = []string{
"v",
"alsologtostderr",
@ -92,10 +87,6 @@ var RootCmd = &cobra.Command{
exit.WithError("logdir set failed", err)
}
}
if enableUpdateNotification {
notify.MaybePrintUpdateTextFromGithub()
}
},
}

View File

@ -30,6 +30,8 @@ import (
"strings"
"time"
"k8s.io/minikube/pkg/minikube/notify"
"github.com/blang/semver"
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/host"
@ -107,13 +109,14 @@ const (
)
var (
registryMirror []string
dockerEnv []string
dockerOpt []string
insecureRegistry []string
apiServerNames []string
apiServerIPs []net.IP
extraOptions cfg.ExtraOptionSlice
registryMirror []string
dockerEnv []string
dockerOpt []string
insecureRegistry []string
apiServerNames []string
apiServerIPs []net.IP
extraOptions cfg.ExtraOptionSlice
enableUpdateNotification = true
)
func init() {
@ -216,6 +219,11 @@ var startCmd = &cobra.Command{
Short: "Starts a local kubernetes cluster",
Long: "Starts a local kubernetes cluster",
Run: runStart,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if enableUpdateNotification {
notify.MaybePrintUpdateTextFromGithub()
}
},
}
// platform generates a user-readable platform message

View File

@ -67,7 +67,7 @@ func MaybePrintUpdateText(url string, lastUpdatePath string) {
}
url := "https://github.com/kubernetes/minikube/releases/tag/v" + latestVersion.String()
out.ErrT(out.WarningType, `minikube {{.version}} is available! Download it: {{.url}}`, out.V{"version": latestVersion, "url": url})
out.T(out.Tip, "To disable this notice, run: 'minikube config set WantUpdateNotification false'")
out.ErrT(out.Tip, "To disable this notice, run: 'minikube config set WantUpdateNotification false'")
}
}