-
Notifications
You must be signed in to change notification settings - Fork 983
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
Fix missing requests when only limits are supplied #1616
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for karpenter-docs-prod canceled.
|
dewjam
commented
Apr 1, 2022
tzneal
reviewed
Apr 1, 2022
ellistarn
reviewed
Apr 1, 2022
dewjam
commented
Apr 4, 2022
bwagner5
reviewed
Apr 6, 2022
bwagner5
approved these changes
Apr 7, 2022
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
pod := ExpectProvisioned(ctx, env.Client, selectionController, provisioningController, provisioner, test.UnschedulablePod(test.PodOptions{}))[0] | ||
ExpectNotScheduled(ctx, env.Client, pod) | ||
}) | ||
It("should not schedule if initContainer resources are too large", func() { |
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 this test named wrong or is it supposed to be InitResourceRequirements
rather than ResourceRequirements
?
This was referenced Apr 8, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1. Issue, if available:
#1573
2. Description of changes: (Edit):
There are two primary changes included in this PR.
First, we will now merge Pod resource Limits into Requests when Requests are not defined. Normally when a pod is created, if only Limits are supplied for a specific resource (no Requests), then the PodSpec is updated so the Requests = Limits when the pod event is created. However, when Karpenter calculates node overhead, it looks at the limits/requests in the PodSpec template of applicable DaemonSets. If only Limits are supplied in the PodSpec template, then requests are never updated to equal limits for resources where requests are not defined. The result is pods can be packed and scheduled onto an instance type which doesn't have enough resources and pods stay in a "Pending" state.
For example, if a manifest contains the below:
The pod will be created as such:
Second, we will now consider InitContainer resources when scheduling/packing pods onto nodes. In short, here is the formula to calculate the resource "Ceiling" for a pod:
3. How was this change tested?
Added a tests to validate the behavior after the change. Tested manually with a DaemonSet with only limits to ensure it was scheduled on a node which has enough resources. Tested manually to ensure init container resources are considered when scheduling.
4. Does this change impact docs?
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.