未验证 提交 5c8afbb0 编写于 作者: S Sharif Elgamal 提交者: GitHub

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

Moved warning to minikube start command and print it to stderr
......@@ -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()
}
},
}
......
......@@ -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
......
......@@ -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'")
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册