scheduler: remove nested retry loops

pull/8/head
Dr. Stefan Schimanski 2018-05-03 23:18:31 +02:00
parent a3a52a8cf7
commit e333ba061f
2 changed files with 7 additions and 16 deletions

View File

@ -32,7 +32,6 @@ go_library(
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//vendor/k8s.io/apiserver/pkg/authentication/authenticator:go_default_library", "//vendor/k8s.io/apiserver/pkg/authentication/authenticator:go_default_library",
"//vendor/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library", "//vendor/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library",
"//vendor/k8s.io/apiserver/pkg/endpoints/filters:go_default_library", "//vendor/k8s.io/apiserver/pkg/endpoints/filters:go_default_library",

View File

@ -23,13 +23,11 @@ import (
"net/http" "net/http"
"os" "os"
goruntime "runtime" goruntime "runtime"
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
utilerrors "k8s.io/apimachinery/pkg/util/errors" utilerrors "k8s.io/apimachinery/pkg/util/errors"
utilruntime "k8s.io/apimachinery/pkg/util/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apiserver/pkg/authentication/authenticator" "k8s.io/apiserver/pkg/authentication/authenticator"
"k8s.io/apiserver/pkg/authorization/authorizer" "k8s.io/apiserver/pkg/authorization/authorizer"
genericapifilters "k8s.io/apiserver/pkg/endpoints/filters" genericapifilters "k8s.io/apiserver/pkg/endpoints/filters"
@ -154,21 +152,15 @@ func Run(c schedulerserverconfig.CompletedConfig, stopCh <-chan struct{}) error
if c.InsecureServing != nil { if c.InsecureServing != nil {
separateMetrics := c.InsecureMetricsServing != nil separateMetrics := c.InsecureMetricsServing != nil
handler := buildHandlerChain(newHealthzHandler(&c.ComponentConfig, separateMetrics), nil, nil) handler := buildHandlerChain(newHealthzHandler(&c.ComponentConfig, separateMetrics), nil, nil)
// TODO: fail early as all other Kubernetes binaries if err := c.InsecureServing.Serve(handler, 0, stopCh); err != nil {
go wait.Until(func() { return fmt.Errorf("failed to start healthz server: %v", err)
if err := c.InsecureServing.Serve(handler, 0, stopCh); err != nil { }
utilruntime.HandleError(fmt.Errorf("failed to start healthz server: %v", err))
}
}, 5*time.Second, stopCh)
} }
if c.InsecureServing != nil { if c.InsecureMetricsServing != nil {
handler := buildHandlerChain(newMetricsHandler(&c.ComponentConfig), nil, nil) handler := buildHandlerChain(newMetricsHandler(&c.ComponentConfig), nil, nil)
// TODO: fail early as all other Kubernetes binaries if err := c.InsecureMetricsServing.Serve(handler, 0, stopCh); err != nil {
go wait.Until(func() { return fmt.Errorf("failed to start metrics server: %v", err)
if err := c.InsecureServing.Serve(handler, 0, stopCh); err != nil { }
utilruntime.HandleError(fmt.Errorf("failed to start metrics server: %v", err))
}
}, 5*time.Second, stopCh)
} }
if c.SecureServing != nil { if c.SecureServing != nil {
handler := buildHandlerChain(newHealthzHandler(&c.ComponentConfig, false), c.Authentication.Authenticator, c.Authorization.Authorizer) handler := buildHandlerChain(newHealthzHandler(&c.ComponentConfig, false), c.Authentication.Authenticator, c.Authorization.Authorizer)