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
ea2192f0
Commit
ea2192f0
authored
Jun 05, 2018
by
vikaschoudhary16
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix quota sync
parent
50178d3e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
resource_quota_controller.go
pkg/controller/resourcequota/resource_quota_controller.go
+1
-1
resources.go
pkg/quota/resources.go
+2
-2
No files found.
pkg/controller/resourcequota/resource_quota_controller.go
View file @
ea2192f0
...
@@ -337,7 +337,7 @@ func (rq *ResourceQuotaController) syncResourceQuota(v1ResourceQuota *v1.Resourc
...
@@ -337,7 +337,7 @@ func (rq *ResourceQuotaController) syncResourceQuota(v1ResourceQuota *v1.Resourc
}
}
hardLimits
:=
quota
.
Add
(
api
.
ResourceList
{},
resourceQuota
.
Spec
.
Hard
)
hardLimits
:=
quota
.
Add
(
api
.
ResourceList
{},
resourceQuota
.
Spec
.
Hard
)
newUsage
,
err
:=
quota
.
CalculateUsage
(
resourceQuota
.
Namespace
,
resourceQuota
.
Spec
.
Scopes
,
hardLimits
,
rq
.
registry
)
newUsage
,
err
:=
quota
.
CalculateUsage
(
resourceQuota
.
Namespace
,
resourceQuota
.
Spec
.
Scopes
,
hardLimits
,
rq
.
registry
,
resourceQuota
.
Spec
.
ScopeSelector
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
pkg/quota/resources.go
View file @
ea2192f0
...
@@ -253,7 +253,7 @@ func ToSet(resourceNames []api.ResourceName) sets.String {
...
@@ -253,7 +253,7 @@ func ToSet(resourceNames []api.ResourceName) sets.String {
}
}
// CalculateUsage calculates and returns the requested ResourceList usage
// CalculateUsage calculates and returns the requested ResourceList usage
func
CalculateUsage
(
namespaceName
string
,
scopes
[]
api
.
ResourceQuotaScope
,
hardLimits
api
.
ResourceList
,
registry
Registry
)
(
api
.
ResourceList
,
error
)
{
func
CalculateUsage
(
namespaceName
string
,
scopes
[]
api
.
ResourceQuotaScope
,
hardLimits
api
.
ResourceList
,
registry
Registry
,
scopeSelector
*
api
.
ScopeSelector
)
(
api
.
ResourceList
,
error
)
{
// find the intersection between the hard resources on the quota
// find the intersection between the hard resources on the quota
// and the resources this controller can track to know what we can
// and the resources this controller can track to know what we can
// look to measure updated usage stats for
// look to measure updated usage stats for
...
@@ -275,7 +275,7 @@ func CalculateUsage(namespaceName string, scopes []api.ResourceQuotaScope, hardL
...
@@ -275,7 +275,7 @@ func CalculateUsage(namespaceName string, scopes []api.ResourceQuotaScope, hardL
continue
continue
}
}
usageStatsOptions
:=
UsageStatsOptions
{
Namespace
:
namespaceName
,
Scopes
:
scopes
,
Resources
:
intersection
}
usageStatsOptions
:=
UsageStatsOptions
{
Namespace
:
namespaceName
,
Scopes
:
scopes
,
Resources
:
intersection
,
ScopeSelector
:
scopeSelector
}
stats
,
err
:=
evaluator
.
UsageStats
(
usageStatsOptions
)
stats
,
err
:=
evaluator
.
UsageStats
(
usageStatsOptions
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
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