-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow supported resource overrides in the limitranger plugin #23280
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,18 @@ limitations under the License. | |
package limitranger | ||
|
||
import ( | ||
"k8s.io/kubernetes/pkg/admission" | ||
"k8s.io/kubernetes/pkg/api" | ||
"k8s.io/kubernetes/pkg/runtime" | ||
) | ||
|
||
// LimitFunc is a pluggable function to enforce limits on the object | ||
type LimitFunc func(limitRange *api.LimitRange, kind string, obj runtime.Object) error | ||
type LimitRangerActions interface { | ||
// Limit is a pluggable function to enforce limits on the object. | ||
Limit(limitRange *api.LimitRange, kind string, obj runtime.Object) error | ||
// SupportsAttributes is a pluggable function to allow overridding what resources the limitranger | ||
// supports. | ||
SupportsAttributes(attr admission.Attributes) bool | ||
// SupportsLimit is a pluggable function to allow ignoring limits that should not be applied | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this is when a limit is referencing a custom type? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, used to filter limit ranges that only apply to images downstream: https://github.com/openshift/origin/pull/7989/files#diff-c0324af3f9610f91b1fde15a63e35bf5R118 |
||
// for any reason. | ||
SupportsLimit(limitRange *api.LimitRange) bool | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we confident in our downstream use cases that we will not forget to include this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can certainly move it back into the main admit method if you think it's worth it.
Here were the two downstream cases I found:
https://github.com/openshift/origin/pull/7989/files#diff-5fd1547857aea1ef0cdb18cb293f88faR210
https://github.com/openshift/origin/pull/7989/files#diff-c0324af3f9610f91b1fde15a63e35bf5R106