Merge pull request #51633 from deads2k/controller-03-wait

Automatic merge from submit-queue (batch tested with PRs 51707, 51662, 51723, 50163, 51633)

update GC controller to wait until controllers have been initialized …

fixes #51013

Alternative to https://github.com/kubernetes/kubernetes/pull/51492 which keeps those few controllers (only one) from starting the informers early.
This commit is contained in:
Kubernetes Submit Queue
2017-08-31 18:43:41 -07:00
committed by GitHub
6 changed files with 30 additions and 3 deletions

View File

@@ -242,6 +242,8 @@ func setup(t *testing.T, workerCount int) *testContext {
metaOnlyClientPool := dynamic.NewClientPool(&config, restMapper, dynamic.LegacyAPIPathResolverFunc)
clientPool := dynamic.NewClientPool(&config, restMapper, dynamic.LegacyAPIPathResolverFunc)
sharedInformers := informers.NewSharedInformerFactory(clientSet, 0)
alwaysStarted := make(chan struct{})
close(alwaysStarted)
gc, err := garbagecollector.NewGarbageCollector(
metaOnlyClientPool,
clientPool,
@@ -249,6 +251,7 @@ func setup(t *testing.T, workerCount int) *testContext {
deletableResources,
garbagecollector.DefaultIgnoredResources(),
sharedInformers,
alwaysStarted,
)
if err != nil {
t.Fatalf("failed to create garbage collector: %v", err)