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
005c67a1
Commit
005c67a1
authored
Mar 05, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22445 from derekwaynecarr/quota_replenish_perf
Auto commit by PR queue bot
parents
168711b3
04b80957
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
resource_quota_controller.go
pkg/controller/resourcequota/resource_quota_controller.go
+16
-2
No files found.
pkg/controller/resourcequota/resource_quota_controller.go
View file @
005c67a1
...
...
@@ -285,7 +285,14 @@ func (rq *ResourceQuotaController) syncResourceQuota(resourceQuota api.ResourceQ
// replenishQuota is a replenishment function invoked by a controller to notify that a quota should be recalculated
func
(
rq
*
ResourceQuotaController
)
replenishQuota
(
groupKind
unversioned
.
GroupKind
,
namespace
string
,
object
runtime
.
Object
)
{
// TODO: make this support targeted replenishment to a specific kind, right now it does a full replenish
// check if the quota controller can evaluate this kind, if not, ignore it altogether...
evaluators
:=
rq
.
registry
.
Evaluators
()
evaluator
,
found
:=
evaluators
[
groupKind
]
if
!
found
{
return
}
// check if this namespace even has a quota...
indexKey
:=
&
api
.
ResourceQuota
{}
indexKey
.
Namespace
=
namespace
resourceQuotas
,
err
:=
rq
.
rqIndexer
.
Index
(
"namespace"
,
indexKey
)
...
...
@@ -295,8 +302,15 @@ func (rq *ResourceQuotaController) replenishQuota(groupKind unversioned.GroupKin
if
len
(
resourceQuotas
)
==
0
{
return
}
// only queue those quotas that are tracking a resource associated with this kind.
matchedResources
:=
evaluator
.
MatchesResources
()
for
i
:=
range
resourceQuotas
{
resourceQuota
:=
resourceQuotas
[
i
]
.
(
*
api
.
ResourceQuota
)
rq
.
enqueueResourceQuota
(
resourceQuota
)
resourceQuotaResources
:=
quota
.
ResourceNames
(
resourceQuota
.
Status
.
Hard
)
if
len
(
quota
.
Intersection
(
matchedResources
,
resourceQuotaResources
))
>
0
{
// TODO: make this support targeted replenishment to a specific kind, right now it does a full recalc on that quota.
rq
.
enqueueResourceQuota
(
resourceQuota
)
}
}
}
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