Clean shutdown of resourcequota integration tests
This commit is contained in:
@@ -269,6 +269,7 @@ func (rq *Controller) worker(ctx context.Context, queue workqueue.RateLimitingIn
|
||||
func (rq *Controller) Run(ctx context.Context, workers int) {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer rq.queue.ShutDown()
|
||||
defer rq.missingUsageQueue.ShutDown()
|
||||
|
||||
klog.Infof("Starting resource quota controller")
|
||||
defer klog.Infof("Shutting down resource quota controller")
|
||||
|
@@ -305,6 +305,8 @@ func (qm *QuotaMonitor) IsSynced() bool {
|
||||
// Run sets the stop channel and starts monitor execution until stopCh is
|
||||
// closed. Any running monitors will be stopped before Run returns.
|
||||
func (qm *QuotaMonitor) Run(stopCh <-chan struct{}) {
|
||||
defer utilruntime.HandleCrash()
|
||||
|
||||
klog.Infof("QuotaMonitor running")
|
||||
defer klog.Infof("QuotaMonitor stopping")
|
||||
|
||||
@@ -317,6 +319,15 @@ func (qm *QuotaMonitor) Run(stopCh <-chan struct{}) {
|
||||
// Start monitors and begin change processing until the stop channel is
|
||||
// closed.
|
||||
qm.StartMonitors()
|
||||
|
||||
// The following workers are hanging forever until the queue is
|
||||
// shutted down, so we need to shut it down in a separate goroutine.
|
||||
go func() {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer qm.resourceChanges.ShutDown()
|
||||
|
||||
<-stopCh
|
||||
}()
|
||||
wait.Until(qm.runProcessResourceChanges, 1*time.Second, stopCh)
|
||||
|
||||
// Stop any running monitors.
|
||||
|
Reference in New Issue
Block a user