-
Notifications
You must be signed in to change notification settings - Fork 288
fix: Ensure DaemonSets with '/initialized' and '/registered' are considered during nodeclaim calculations #2161
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
base: main
Are you sure you want to change the base?
Conversation
Welcome @1mwataru! |
Hi @1mwataru. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Pull Request Test Coverage Report for Build 15683847793Details
💛 - Coveralls |
/assign @jonathan-innis |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 1mwataru The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -70,6 +70,12 @@ func NewNodeClaimTemplate(nodePool *v1.NodePool) *NodeClaimTemplate { | |||
}) | |||
nct.Requirements.Add(scheduling.NewNodeSelectorRequirementsWithMinValues(nct.Spec.Requirements...).Values()...) | |||
nct.Requirements.Add(scheduling.NewLabelRequirements(nct.Labels).Values()...) | |||
|
|||
// Add requirements for DaemonSet scheduling calculations |
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.
This looks good! Can we add one test to make sure that this works properly on the two new labels? Maybe something with affinity?
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.
I have implemented a test that verifies nodes are launched with properly calculated daemonOverhead and scheduled correctly when NodeAffinity is configured for each respective label.
@@ -80,6 +86,14 @@ func (i *NodeClaimTemplate) ToNodeClaim() *v1.NodeClaim { | |||
return i.Name | |||
})...)) | |||
|
|||
// Filter out DaemonSet scheduling-only requirements for the actual NodeClaim |
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: These may not just be DaemonSet scheduling requirements -- I'm not sure why you would do this on things other than DaemonSets, but we should technically support this for any pod that selected against this label
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.
@jonathan-innis
Thanks for your comment.
Apologies for the delay.
We exclude other workloads like Deployments due to the following scenarios:
- When node affinity for these labels are applied to Deployments, current validation rejects them during NodeClaim creation, preventing NodeClaim creation entirely
- Simply removing this validation leads to unintended behavior:
- Deployments create Pending Pods, triggering new NodeClaim creation
- Pods remain unscheduled until Nodes become registered/initialized, causing redundant NodeClaim creation
Addressing this would require logic to prevent excessive NodeClaim creation when Pending Pods exist with registered/initialized labels.
This represents a not small change beyond this Issue's scope, so we excluded it.
(Please let me know if we should create a separate Issue for investigation, or if any comments need modification.)
…idered during nodeclaim calculations
Fixes #2116
Description
When Daemonsets has nodeAffinity or nodeSelector related to
karpenter.sh/registered
andkarpenter.sh/initialized
labels, these are not considered during NodeClaim calculations, resulting in nodes being launched with smaller sizes than expected.Modified the code to consider
karpenter.sh/registered
andkarpenter.sh/initialized
labels during Daemonset overhead calculations.How was this change tested?
Prerequisites
karpenter.sh/registered
label)Before the change
Confirmed from Karpenter logs that My Daemonset was not considered in the request value (
"cpu":"1150m"
)As a result, an EC2 instance of type c5d.large (allocatable cpu: 1930m) was launched, but the Daemonset remained in Pending state
After the change
Confirmed from Karpenter logs that My Daemonset was now considered in the request value (
"cpu":"3150m"
)The Daemonset started successfully without issues
Manifests used for verification
NodePool
nodepool.yaml
Deployment and Deamonset
dep_deamon.yaml