Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3075d855
Commit
3075d855
authored
May 17, 2016
by
derekwaynecarr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Have quota controller use a rate limiter to avoid hot-loops
parent
959e6ca6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
resource_quota_controller.go
pkg/controller/resourcequota/resource_quota_controller.go
+7
-5
No files found.
pkg/controller/resourcequota/resource_quota_controller.go
View file @
3075d855
...
...
@@ -62,7 +62,7 @@ type ResourceQuotaController struct {
// Watches changes to all resource quota
rqController
*
framework
.
Controller
// ResourceQuota objects that need to be synchronized
queue
*
workqueue
.
Typ
e
queue
workqueue
.
RateLimitingInterfac
e
// To allow injection of syncUsage for testing.
syncHandler
func
(
key
string
)
error
// function that controls full recalculation of quota usage
...
...
@@ -77,7 +77,7 @@ func NewResourceQuotaController(options *ResourceQuotaControllerOptions) *Resour
// build the resource quota controller
rq
:=
&
ResourceQuotaController
{
kubeClient
:
options
.
KubeClient
,
queue
:
workqueue
.
New
(
),
queue
:
workqueue
.
New
RateLimitingQueue
(
workqueue
.
DefaultControllerRateLimiter
()
),
resyncPeriod
:
options
.
ResyncPeriod
,
registry
:
options
.
Registry
,
replenishmentControllers
:
[]
framework
.
ControllerInterface
{},
...
...
@@ -170,10 +170,12 @@ func (rq *ResourceQuotaController) worker() {
}
defer
rq
.
queue
.
Done
(
key
)
err
:=
rq
.
syncHandler
(
key
.
(
string
))
if
err
!
=
nil
{
utilruntime
.
HandleError
(
err
)
r
q
.
queue
.
Add
(
key
)
if
err
=
=
nil
{
rq
.
queue
.
Forget
(
key
)
r
eturn
false
}
utilruntime
.
HandleError
(
err
)
rq
.
queue
.
AddRateLimited
(
key
)
return
false
}
for
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment