UPSTREAM: <drop>: remove hacks for delaying post start hooks
@@ -20,16 +20,12 @@ import (
"errors"
"fmt"
"net/http"
- "time"
"github.com/golang/glog"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
- "k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apiserver/pkg/server/healthz"
restclient "k8s.io/client-go/rest"
- coreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
)
// PostStartHookFunc is a function that is called after the server has started.
@@ -100,33 +96,6 @@ func (s *GenericAPIServer) RunPostStartHooks() {
context := PostStartHookContext{LoopbackClientConfig: s.LoopbackClientConfig}
- // only wait for namespace in a real kube master setup. In unit tests, we don't have the namespace resource
- // and therefore the wait loop would fail.
- isKubeMaster := false
- for _, ws := range s.HandlerContainer.RegisteredWebServices() {
- if ws.RootPath() == "/api/v1" {
- isKubeMaster = true
- }
- }
- if isKubeMaster {
- // we need to wait until our loopback client has enough rights to actually loopback
- // the core APIs cannot be disabled, so we'll use that as a proxy for the information instead
- // of attempting a SAR (which can be disabled, though that would be a very bad idea)
- // TODO remove once openshift starts using the kube loopback connection.
- err := wait.PollImmediate(30*time.Millisecond, 30*time.Second, func() (bool, error) {
- client := coreclient.NewForConfigOrDie(s.LoopbackClientConfig)
- // we can have other errors in our level, like etcd not being up. Treat them all the same
- if _, err := client.Namespaces().List(metav1.ListOptions{}); err != nil {
- fmt.Printf("loopback error: %v\n", err)
- return false, nil
- }
- return true, nil
- })
- if err != nil {
- glog.Fatalf("LoopbackClient was unable to list namespaces: %v", err)
- }
- }
-
for hookName, hookEntry := range s.postStartHooks {
go runPostStartHook(hookName, hookEntry, context)
}
