From 7c18e303eb3e59237ed02e68a852c15f1d3cc518 Mon Sep 17 00:00:00 2001 From: Dan Ramich Date: Tue, 29 Sep 2020 09:02:37 -0600 Subject: [PATCH] Add sleep before applying webhook config --- pkg/admission/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/admission/server.go b/pkg/admission/server.go index c96cfbea4..1d7b82612 100644 --- a/pkg/admission/server.go +++ b/pkg/admission/server.go @@ -3,12 +3,14 @@ package admission import ( "context" "net/http" + "time" "github.com/rancher/dynamiclistener" "github.com/rancher/dynamiclistener/server" "github.com/rancher/wrangler/pkg/apply" "github.com/rancher/wrangler/pkg/generated/controllers/core" "github.com/rancher/wrangler/pkg/schemes" + "github.com/sirupsen/logrus" v1 "k8s.io/api/admissionregistration/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -60,6 +62,10 @@ func listenAndServe(ctx context.Context, cfg *rest.Config, handler http.Handler) return nil, nil } + logrus.Info("Sleeping for 15 seconds then applying webhook config") + // Sleep here to make sure server is listening and all caches are primed + time.Sleep(15 * time.Second) + return secret, apply.WithOwner(secret).ApplyObjects(&v1.ValidatingWebhookConfiguration{ ObjectMeta: metav1.ObjectMeta{ Name: "rancher.cattle.io",