-
Notifications
You must be signed in to change notification settings - Fork 330
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
Enforce container resources without max/min values #185
Enforce container resources without max/min values #185
Conversation
Signed-off-by: Oleg Vorobev <[email protected]>
6ecb737
to
769257d
Compare
@maxsmythe @ritazh is there any chance to get your review/opinion about this? |
Sorry for the slow response :/ I like the idea of this CT! I haven't had time to look through the tests, but the overall code LGTM. Any chance this could be updated to also support ephemeral containers, per #191 ? |
Hey @maxsmythe! |
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.
Thank you for checking WRT the ephemeral container!
The code looks good, I have a couple nits WRT test names and parameter validation.
object: samples/container-must-have-limits-and-requests/example_allowed1.yaml | ||
assertions: | ||
- violations: no | ||
- name: example-disallowed1 |
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.
nit: I wonder if we could name these tests to explain what they are testing?
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.
Renamed tests, but not sure if it's more readable/clear now, do you have any naming conventions?
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.
No conventions as yet, since the test function is fairly new, but this is much more clear. Thank you for doing this!
It is recommended that users use the fully-qualified Docker image name (e.g. start with a domain name) | ||
in order to avoid unexpectedly exempting images from an untrusted repository. | ||
type: array | ||
items: |
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.
Is it possible to add a regex check for the string so that users get an error if they type anything other than "cpu" or "memory"?
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.
Added enum to validate the values.
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.
thanks!
Signed-off-by: Oleg Vorobev <[email protected]>
Signed-off-by: Oleg Vorobev <[email protected]>
...must-have-cpu-requests-memory-limits-and-requests/only-memory-limits-defined-disallowed.yaml
Show resolved
Hide resolved
LGTM |
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.
LGTM
I've created this template to only enforce the presence of resources defined in the constraint without specifying min/max values like in
containerrequests
andcontainerlimits
.That's my first time using
rego
so would appreciate any suggestions to make it look and work better if possible.