@@ -30,6 +30,7 @@ import (
30
30
31
31
"k8s.io/apimachinery/pkg/fields"
32
32
"k8s.io/apimachinery/pkg/util/intstr"
33
+ "k8s.io/apimachinery/pkg/util/runtime"
33
34
"k8s.io/apimachinery/pkg/util/wait"
34
35
clientset "k8s.io/client-go/kubernetes"
35
36
"k8s.io/client-go/kubernetes/scheme"
@@ -322,15 +323,6 @@ func newIngressController(config *Configuration) *GenericController {
322
323
return & ic
323
324
}
324
325
325
- func (ic * GenericController ) controllersInSync () bool {
326
- return ic .ingController .HasSynced () &&
327
- ic .svcController .HasSynced () &&
328
- ic .endpController .HasSynced () &&
329
- ic .secrController .HasSynced () &&
330
- ic .mapController .HasSynced () &&
331
- ic .nodeController .HasSynced ()
332
- }
333
-
334
326
// Info returns information about the backend
335
327
func (ic GenericController ) Info () * ingress.BackendInfo {
336
328
return ic .cfg .Backend .Info ()
@@ -379,11 +371,6 @@ func (ic *GenericController) syncIngress(key interface{}) error {
379
371
return nil
380
372
}
381
373
382
- if ! ic .controllersInSync () {
383
- time .Sleep (podStoreSyncedPollPeriod )
384
- return fmt .Errorf ("deferring sync till endpoints controller has synced" )
385
- }
386
-
387
374
upstreams , servers := ic .getBackendServers ()
388
375
var passUpstreams []* ingress.SSLPassthroughBackend
389
376
for _ , server := range servers {
@@ -1161,6 +1148,18 @@ func (ic GenericController) Start() {
1161
1148
go ic .secrController .Run (ic .stopCh )
1162
1149
go ic .mapController .Run (ic .stopCh )
1163
1150
1151
+ // Wait for all involved caches to be synced, before processing items from the queue is started
1152
+ if ! cache .WaitForCacheSync (ic .stopCh ,
1153
+ ic .ingController .HasSynced ,
1154
+ ic .svcController .HasSynced ,
1155
+ ic .endpController .HasSynced ,
1156
+ ic .secrController .HasSynced ,
1157
+ ic .mapController .HasSynced ,
1158
+ ic .nodeController .HasSynced ,
1159
+ ) {
1160
+ runtime .HandleError (fmt .Errorf ("Timed out waiting for caches to sync" ))
1161
+ }
1162
+
1164
1163
go ic .syncQueue .Run (10 * time .Second , ic .stopCh )
1165
1164
1166
1165
go wait .Forever (ic .syncSecret , 10 * time .Second )
0 commit comments