Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a crucial enhancement for Kubernetes resource management by automatically clamping CPU and memory requests. It addresses a common pain point where pods fail to schedule when their requested resources precisely match a node's total capacity, without accounting for the system overhead reserved by Kubernetes components. By dynamically adjusting these requests to the node's allocatable capacity, the system ensures more robust and successful pod scheduling, particularly in scenarios where resource requests are at the upper limit of available nodes. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new utility function, adjust_resources_to_allocatable, to dynamically adjust requested CPU and memory resources for Kubernetes pods. This adjustment accounts for system overhead when the request matches node capacity and no larger node is available, aiming to prevent scheduling errors. The make_deploy_resources_variables function is updated to utilize this new utility. Additionally, resource fitting checks in check_cpu_mem_fits and check_tpu_fits were modified to use inclusive comparisons ('>=') for CPU and memory requirements. However, two critical issues were identified: the overhead calculation incorrectly subtracts a safety margin, which could lead to adjusted requests exceeding allocatable limits, and the has_larger_node check is insufficient as it only considers CPU, potentially causing pods to get stuck in a pending state due to unadjusted memory requests.
Tested (run the relevant ones):
bash format.sh/smoke-test(CI) orpytest tests/test_smoke.py(local)/smoke-test -k test_name(CI) orpytest tests/test_smoke.py::test_name(local)/quicktest-core(CI) orpytest tests/smoke_tests/test_backward_compat.py(local)