@@ -310,7 +310,7 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
310
310
ctx , cancel := context .WithCancel (context .Background ())
311
311
go func () {
312
312
select {
313
- case <- postStartHookContext .StopCh :
313
+ case <- postStartHookContext .Done () :
314
314
cancel () // stopCh closed, so cancel our context
315
315
case <- ctx .Done ():
316
316
}
@@ -373,9 +373,9 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
373
373
}
374
374
375
375
s .GenericAPIServer .AddPostStartHookOrDie ("apiservice-registration-controller" , func (context genericapiserver.PostStartHookContext ) error {
376
- go apiserviceRegistrationController .Run (context .StopCh , apiServiceRegistrationControllerInitiated )
376
+ go apiserviceRegistrationController .Run (context .Done () , apiServiceRegistrationControllerInitiated )
377
377
select {
378
- case <- context .StopCh :
378
+ case <- context .Done () :
379
379
case <- apiServiceRegistrationControllerInitiated :
380
380
}
381
381
@@ -394,7 +394,7 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
394
394
// Discovery aggregation depends on the apiservice registration controller
395
395
// having the full list of APIServices already synced
396
396
select {
397
- case <- context .StopCh :
397
+ case <- context .Done () :
398
398
return nil
399
399
// Context cancelled, should abort/clean goroutines
400
400
case <- apiServiceRegistrationControllerInitiated :
@@ -405,10 +405,10 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
405
405
// When discovery is ready, all APIServices will be present, with APIServices
406
406
// that have not successfully synced discovery to be present but marked as Stale.
407
407
discoverySyncedCh := make (chan struct {})
408
- go s .discoveryAggregationController .Run (context .StopCh , discoverySyncedCh )
408
+ go s .discoveryAggregationController .Run (context .Done () , discoverySyncedCh )
409
409
410
410
select {
411
- case <- context .StopCh :
411
+ case <- context .Done () :
412
412
return nil
413
413
// Context cancelled, should abort/clean goroutines
414
414
case <- discoverySyncedCh :
@@ -440,7 +440,7 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
440
440
return false , err
441
441
}
442
442
return true , nil
443
- }, hookContext .StopCh ); err != nil {
443
+ }, hookContext .Done () ); err != nil {
444
444
return fmt .Errorf ("failed to wait for apiserver-identity lease %s to be created: %v" ,
445
445
s .GenericAPIServer .APIServerID , err )
446
446
}
@@ -456,14 +456,14 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
456
456
// to register all built-in resources when the generic apiservers install APIs.
457
457
s .GenericAPIServer .StorageVersionManager .UpdateStorageVersions (hookContext .LoopbackClientConfig , s .GenericAPIServer .APIServerID )
458
458
return false , nil
459
- }, hookContext .StopCh )
459
+ }, hookContext .Done () )
460
460
// Once the storage version updater finishes the first round of update,
461
461
// the PostStartHook will return to unblock /healthz. The handler chain
462
462
// won't block write requests anymore. Check every second since it's not
463
463
// expensive.
464
464
wait .PollImmediateUntil (1 * time .Second , func () (bool , error ) {
465
465
return s .GenericAPIServer .StorageVersionManager .Completed (), nil
466
- }, hookContext .StopCh )
466
+ }, hookContext .Done () )
467
467
return nil
468
468
})
469
469
}
@@ -477,14 +477,14 @@ func (s *APIAggregator) PrepareRun() (preparedAPIAggregator, error) {
477
477
// add post start hook before generic PrepareRun in order to be before /healthz installation
478
478
if s .openAPIConfig != nil {
479
479
s .GenericAPIServer .AddPostStartHookOrDie ("apiservice-openapi-controller" , func (context genericapiserver.PostStartHookContext ) error {
480
- go s .openAPIAggregationController .Run (context .StopCh )
480
+ go s .openAPIAggregationController .Run (context .Done () )
481
481
return nil
482
482
})
483
483
}
484
484
485
485
if s .openAPIV3Config != nil {
486
486
s .GenericAPIServer .AddPostStartHookOrDie ("apiservice-openapiv3-controller" , func (context genericapiserver.PostStartHookContext ) error {
487
- go s .openAPIV3AggregationController .Run (context .StopCh )
487
+ go s .openAPIV3AggregationController .Run (context .Done () )
488
488
return nil
489
489
})
490
490
}
0 commit comments