feat(env): Add automatic memory limit handling#457
feat(env): Add automatic memory limit handling#457dongjiang1989 wants to merge 5 commits intokubernetes-sigs:mainfrom
Conversation
Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
✅ Deploy Preview for agent-sandbox canceled.
|
|
Seems like a nifty improvement. What are the downsides of automatically setting it to x% of available mem ? Is this a common pattern ? |
90% of available mem. Good user case in prometheus-operator and kube-state-metrics |
| go 1.26.1 | ||
|
|
||
| require ( | ||
| github.com/KimMachineGun/automemlimit v0.7.5 |
There was a problem hiding this comment.
We should be careful about taking external dependencies; they have a habit of become unmaintained and then we're stuck maintaining them, so it's often easier just to reimplement them. I think the question about the default behaviour of go is the most important one, though, more than this dependency (it is MIT licensed and looks to be maintained)
|
So I actually thought we'd fixed this in go, but it looks like we haven't yet. I know @BenTheElder has tackled this in other kubernetes projects - any advice for us? |
Signed-off-by: dongjiang <dongjiang1989@126.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dongjiang1989 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
How does it compare to using downward API to get the memlimit and using that during startup (main.go) to set the |
Signed-off-by: dongjiang <dongjiang1989@126.com>
Thanks @barney-s Great question! The key difference is automation, portability, and reliability compared to the Downward API + manual
In short: automemlimit does exactly what your manual code does, but automatically, portably, and safely across all containerized environments. |
add auto
GOMEMLIMITsetting