未验证 提交 5c1af0c7 编写于 作者: T Thomas Strömberg 提交者: GitHub

Merge pull request #7119 from tstromberg/less-err-spam

Wait 30 seconds before spamming console with error logs
...@@ -40,17 +40,18 @@ import ( ...@@ -40,17 +40,18 @@ import (
"k8s.io/minikube/pkg/minikube/logs" "k8s.io/minikube/pkg/minikube/logs"
) )
// minLogCheckTime how long to wait before spamming error logs to console
const minLogCheckTime = 30 * time.Second
// WaitForAPIServerProcess waits for api server to be healthy returns error if it doesn't // WaitForAPIServerProcess waits for api server to be healthy returns error if it doesn't
func WaitForAPIServerProcess(r cruntime.Manager, bs bootstrapper.Bootstrapper, cr command.Runner, start time.Time, timeout time.Duration) error { func WaitForAPIServerProcess(r cruntime.Manager, bs bootstrapper.Bootstrapper, cr command.Runner, start time.Time, timeout time.Duration) error {
glog.Infof("waiting for apiserver process to appear ...") glog.Infof("waiting for apiserver process to appear ...")
minLogTime := kconst.APICallRetryInterval * 10
err := wait.PollImmediate(time.Millisecond*500, timeout, func() (bool, error) { err := wait.PollImmediate(time.Millisecond*500, timeout, func() (bool, error) {
if time.Since(start) > timeout { if time.Since(start) > timeout {
return false, fmt.Errorf("cluster wait timed out during process check") return false, fmt.Errorf("cluster wait timed out during process check")
} }
if time.Since(start) > minLogTime { if time.Since(start) > minLogCheckTime {
announceProblems(r, bs, cr) announceProblems(r, bs, cr)
time.Sleep(kconst.APICallRetryInterval * 5) time.Sleep(kconst.APICallRetryInterval * 5)
} }
...@@ -81,13 +82,12 @@ func apiServerPID(cr command.Runner) (int, error) { ...@@ -81,13 +82,12 @@ func apiServerPID(cr command.Runner) (int, error) {
func WaitForSystemPods(r cruntime.Manager, bs bootstrapper.Bootstrapper, cr command.Runner, client *kubernetes.Clientset, start time.Time, timeout time.Duration) error { func WaitForSystemPods(r cruntime.Manager, bs bootstrapper.Bootstrapper, cr command.Runner, client *kubernetes.Clientset, start time.Time, timeout time.Duration) error {
glog.Info("waiting for kube-system pods to appear ...") glog.Info("waiting for kube-system pods to appear ...")
pStart := time.Now() pStart := time.Now()
minLogTime := kconst.APICallRetryInterval * 10
podList := func() (bool, error) { podList := func() (bool, error) {
if time.Since(start) > timeout { if time.Since(start) > timeout {
return false, fmt.Errorf("cluster wait timed out during pod check") return false, fmt.Errorf("cluster wait timed out during pod check")
} }
if time.Since(start) > minLogTime { if time.Since(start) > minLogCheckTime {
announceProblems(r, bs, cr) announceProblems(r, bs, cr)
time.Sleep(kconst.APICallRetryInterval * 5) time.Sleep(kconst.APICallRetryInterval * 5)
} }
...@@ -116,13 +116,12 @@ func WaitForHealthyAPIServer(r cruntime.Manager, bs bootstrapper.Bootstrapper, c ...@@ -116,13 +116,12 @@ func WaitForHealthyAPIServer(r cruntime.Manager, bs bootstrapper.Bootstrapper, c
glog.Infof("waiting for apiserver healthz status ...") glog.Infof("waiting for apiserver healthz status ...")
hStart := time.Now() hStart := time.Now()
minLogTime := kconst.APICallRetryInterval * 10
healthz := func() (bool, error) { healthz := func() (bool, error) {
if time.Since(start) > timeout { if time.Since(start) > timeout {
return false, fmt.Errorf("cluster wait timed out during healthz check") return false, fmt.Errorf("cluster wait timed out during healthz check")
} }
if time.Since(start) > minLogTime { if time.Since(start) > minLogCheckTime {
announceProblems(r, bs, cr) announceProblems(r, bs, cr)
time.Sleep(kconst.APICallRetryInterval * 5) time.Sleep(kconst.APICallRetryInterval * 5)
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册