File tree 1 file changed +11
-4
lines changed 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -476,6 +476,11 @@ func (cm *controllerManager) Start(ctx context.Context) (err error) {
476
476
go cm .serveHealthProbes ()
477
477
}
478
478
479
+ // Webhooks MUST start before any cache is populated, otherwise there is a race condition
480
+ // between conversion webhooks and the cache sync (usually initial list) which causes the webhooks
481
+ // to never start because no cache can be populated.
482
+ cm .startWebhookRunnables ()
483
+
479
484
go cm .startNonLeaderElectionRunnables ()
480
485
481
486
go func () {
@@ -573,13 +578,10 @@ func (cm *controllerManager) waitForRunnableToEnd(shutdownCancel context.CancelF
573
578
return nil
574
579
}
575
580
576
- func (cm * controllerManager ) startNonLeaderElectionRunnables () {
581
+ func (cm * controllerManager ) startWebhookRunnables () {
577
582
cm .mu .Lock ()
578
583
defer cm .mu .Unlock ()
579
584
580
- // First start any webhook servers, which includes conversion, validation, and defaulting
581
- // webhooks that are registered.
582
- //
583
585
// WARNING: Webhooks MUST start before any cache is populated, otherwise there is a race condition
584
586
// between conversion webhooks and the cache sync (usually initial list) which causes the webhooks
585
587
// to never start because no cache can be populated.
@@ -588,6 +590,11 @@ func (cm *controllerManager) startNonLeaderElectionRunnables() {
588
590
cm .startRunnable (c )
589
591
}
590
592
}
593
+ }
594
+
595
+ func (cm * controllerManager ) startNonLeaderElectionRunnables () {
596
+ cm .mu .Lock ()
597
+ defer cm .mu .Unlock ()
591
598
592
599
// Start and wait for caches.
593
600
cm .waitForCache (cm .internalCtx )
You can’t perform that action at this time.
0 commit comments