-
Notifications
You must be signed in to change notification settings - Fork 1.1k
log: add warn log when resource request greater than limit #504
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
Conversation
sdudoladov
left a comment
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.
Please also add this warning to the code that configures sidecars and init containers as they are also affected. Note that a Scalyr sidecar is configured separately.
they already use RequestIsSmallerThanLimit to judge and log a warn, what else do you want? |
Signed-off-by: zhangyue <zy675793960@yeah.net>
logging a warning when a resource request as seen by the operator is greater than the limit for all the containers that an operator can potentially create. This includes up to 4 container types:
the whole idea is to make visible in the logs a situation where a container cannot start because the memory request > limit . Right now finding this is the case involves running |
|
|
||
| isSmaller, err := util.RequestIsSmallerThanLimit(spec.ResourceRequests.Memory, spec.ResourceLimits.Memory) | ||
| if err == nil && !isSmaller { | ||
| notAllowed("memoryRequest", "higher than resource limit") |
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.
That won't work because that will reject the legitimate case of request being equal to limit.
In RequestIsSmallerThanLimit, the line
return request.Cmp(limit) == -1, nilis responsible for that . request.Cmp(limit) will return zero if quantities are equal. Please check Kubernetes source code / docs for that method.
Signed-off-by: zhangyue zy675793960@yeah.net
add warn log when memory resource request greater than limit
fix #418