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
4e6a8fbd
Commit
4e6a8fbd
authored
Apr 12, 2019
by
Jordan Liggitt
Committed by
Mansi Agarwal
Apr 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Short-circuit quota admission rejection on zero-delta updates
parent
7a47bc3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
controller.go
plugin/pkg/admission/resourcequota/controller.go
+23
-23
No files found.
plugin/pkg/admission/resourcequota/controller.go
View file @
4e6a8fbd
...
...
@@ -468,29 +468,6 @@ func CheckRequest(quotas []corev1.ResourceQuota, a admission.Attributes, evaluat
restrictedResourcesSet
.
Insert
(
localRestrictedResourcesSet
.
List
()
...
)
}
// verify that for every resource that had limited by default consumption
// enabled that there was a corresponding quota that covered its use.
// if not, we reject the request.
hasNoCoveringQuota
:=
limitedResourceNamesSet
.
Difference
(
restrictedResourcesSet
)
if
len
(
hasNoCoveringQuota
)
>
0
{
return
quotas
,
admission
.
NewForbidden
(
a
,
fmt
.
Errorf
(
"insufficient quota to consume: %v"
,
strings
.
Join
(
hasNoCoveringQuota
.
List
(),
","
)))
}
// verify that for every scope that had limited access enabled
// that there was a corresponding quota that covered it.
// if not, we reject the request.
scopesHasNoCoveringQuota
,
err
:=
evaluator
.
UncoveredQuotaScopes
(
limitedScopes
,
restrictedScopes
)
if
err
!=
nil
{
return
quotas
,
err
}
if
len
(
scopesHasNoCoveringQuota
)
>
0
{
return
quotas
,
fmt
.
Errorf
(
"insufficient quota to match these scopes: %v"
,
scopesHasNoCoveringQuota
)
}
if
len
(
interestingQuotaIndexes
)
==
0
{
return
quotas
,
nil
}
// Usage of some resources cannot be counted in isolation. For example, when
// the resource represents a number of unique references to external
// resource. In such a case an evaluator needs to process other objects in
...
...
@@ -537,6 +514,29 @@ func CheckRequest(quotas []corev1.ResourceQuota, a admission.Attributes, evaluat
return
quotas
,
nil
}
// verify that for every resource that had limited by default consumption
// enabled that there was a corresponding quota that covered its use.
// if not, we reject the request.
hasNoCoveringQuota
:=
limitedResourceNamesSet
.
Difference
(
restrictedResourcesSet
)
if
len
(
hasNoCoveringQuota
)
>
0
{
return
quotas
,
admission
.
NewForbidden
(
a
,
fmt
.
Errorf
(
"insufficient quota to consume: %v"
,
strings
.
Join
(
hasNoCoveringQuota
.
List
(),
","
)))
}
// verify that for every scope that had limited access enabled
// that there was a corresponding quota that covered it.
// if not, we reject the request.
scopesHasNoCoveringQuota
,
err
:=
evaluator
.
UncoveredQuotaScopes
(
limitedScopes
,
restrictedScopes
)
if
err
!=
nil
{
return
quotas
,
err
}
if
len
(
scopesHasNoCoveringQuota
)
>
0
{
return
quotas
,
fmt
.
Errorf
(
"insufficient quota to match these scopes: %v"
,
scopesHasNoCoveringQuota
)
}
if
len
(
interestingQuotaIndexes
)
==
0
{
return
quotas
,
nil
}
outQuotas
,
err
:=
copyQuotas
(
quotas
)
if
err
!=
nil
{
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