Commit 505ccb88 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #54041 from malc0lm/rm-replenishmentControllers-Run

Automatic merge from submit-queue (batch tested with PRs 54030, 54041). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Adjust replenishmentControllers in resource quota controller **What this PR does / why we need it**: Since replenishmentControllers was generated by ctx.InformerFactory, remove "replenishmentControllers []cache.Controller" which is never used, and it is needless to run replenishmentControllers which has ran in "ctx.InformerFactory.Start(ctx.Stop)". **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note ```
parents 229cbf4b efdf99d0
...@@ -79,21 +79,18 @@ type ResourceQuotaController struct { ...@@ -79,21 +79,18 @@ type ResourceQuotaController struct {
resyncPeriod controller.ResyncPeriodFunc resyncPeriod controller.ResyncPeriodFunc
// knows how to calculate usage // knows how to calculate usage
registry quota.Registry registry quota.Registry
// controllers monitoring to notify for replenishment
replenishmentControllers []cache.Controller
} }
func NewResourceQuotaController(options *ResourceQuotaControllerOptions) *ResourceQuotaController { func NewResourceQuotaController(options *ResourceQuotaControllerOptions) *ResourceQuotaController {
// build the resource quota controller // build the resource quota controller
rq := &ResourceQuotaController{ rq := &ResourceQuotaController{
rqClient: options.QuotaClient, rqClient: options.QuotaClient,
rqLister: options.ResourceQuotaInformer.Lister(), rqLister: options.ResourceQuotaInformer.Lister(),
informerSyncedFuncs: []cache.InformerSynced{options.ResourceQuotaInformer.Informer().HasSynced}, informerSyncedFuncs: []cache.InformerSynced{options.ResourceQuotaInformer.Informer().HasSynced},
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "resourcequota_primary"), queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "resourcequota_primary"),
missingUsageQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "resourcequota_priority"), missingUsageQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "resourcequota_priority"),
resyncPeriod: options.ResyncPeriod, resyncPeriod: options.ResyncPeriod,
registry: options.Registry, registry: options.Registry,
replenishmentControllers: []cache.Controller{},
} }
// set the synchronization handler // set the synchronization handler
rq.syncHandler = rq.syncResourceQuotaFromKey rq.syncHandler = rq.syncResourceQuotaFromKey
...@@ -238,11 +235,6 @@ func (rq *ResourceQuotaController) Run(workers int, stopCh <-chan struct{}) { ...@@ -238,11 +235,6 @@ func (rq *ResourceQuotaController) Run(workers int, stopCh <-chan struct{}) {
glog.Infof("Starting resource quota controller") glog.Infof("Starting resource quota controller")
defer glog.Infof("Shutting down resource quota controller") defer glog.Infof("Shutting down resource quota controller")
// the controllers that replenish other resources to respond rapidly to state changes
for _, replenishmentController := range rq.replenishmentControllers {
go replenishmentController.Run(stopCh)
}
if !controller.WaitForCacheSync("resource quota", stopCh, rq.informerSyncedFuncs...) { if !controller.WaitForCacheSync("resource quota", stopCh, rq.informerSyncedFuncs...) {
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment