-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Add csinode limit awareness in cluster-autoscaler #8721
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: master
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: gnufied 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 |
c6d08e7 to
c26409b
Compare
|
@mtrqq Could you do a first-pass review here? This is supposed to follow the way that DRA integration was implemented in CA as much as possible, but instead of the DRA objects we have |
10b6319 to
18906a8
Compare
48c0b28 to
2a287f3
Compare
|
@mtrqq yes, the PR is ready for review. It was marked WIP, because I had to keep rebasing it and I had to make bunch of changes because of latest kube rebase. Even the tests that are still failing are most likely unrelated to this change and are happening because of kube version bump. |
2a287f3 to
2811f12
Compare
2811f12 to
e673a9b
Compare
Bump vendor dependencies for latest k8s master
Fix code to use new framework
e673a9b to
dd1da1e
Compare
|
@gnufied: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
| return nil, err | ||
| } | ||
|
|
||
| wrappedNodeInfo := framework.WrapSchedulerNodeInfo(schedNodeInfo, nil, nil) |
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.
It took me sometime to understand that you've changed the approach from wrapping the node info object inside the CSI/DRA snapshots to mutating the node info object inplace, this somewhat aligns with the approach to reduce the memory allocations when handling node infos, I like this part.
But can we come up with a consistent name for this method across snapshots? For example - AugmentNodeInfo
| "k8s.io/klog/v2" | ||
| fwk "k8s.io/kube-scheduler/framework" | ||
| schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" | ||
| intreeschedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" |
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.
Why change the import name here? The previous name is consistent across the other parts of the codebase and I don't see how the new name is better
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.
So, they changed some of the interfaces in kube-scheduler and I renamed this import because it felt more consistent.
But, Please ignore these renaming for now, because once I rebase my PR with #8827 then these renamings will be gone.
| "k8s.io/klog/v2" | ||
| fwk "k8s.io/kube-scheduler/framework" | ||
| schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" | ||
| intreeschedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" |
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.
Why change the import name here? The previous name is consistent across the other parts of the codebase and I don't see how the new name is better
|
|
||
| // Provider provides access to CSI node information for the cluster. | ||
| type Provider struct { | ||
| csINodesLister v1storagelister.CSINodeLister |
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.
casing typo: csiNodesLister
| } | ||
|
|
||
| // AddCSINodes adds a list of CSI nodes to the snapshot. | ||
| func (s *Snapshot) AddCSINodes(csiNodes []*storagev1.CSINode) error { |
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.
Can we reuse AddCSINode here?
| return result | ||
| } | ||
|
|
||
| func (n *NodeInfo) AddNodeResourceSlices(slices []*resourceapi.ResourceSlice) *NodeInfo { |
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 resolve the error by adding comments to new public methods
exported method NodeInfo.AddCSINode should have comment or be unexported
| } | ||
|
|
||
| // Validate CSINode if expected | ||
| if config.expectedCSINode != nil { |
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.
These nested conditions are extremely hard to read, and while in principle I can understand what's supposed to happen here - it's hard to analyse and likely debug. I would advice to move that to helper function and use short-circuit returns for such validation
if config.expectedCSINode == nil || nodeInfo.CSINode == nil
{
...check that nil value match
return fmt.Errorf("...")
}
if len(expectedDrivers) != len(gotDrivers) {
return fmt.Errorf("...")
}
Same can be done for the rest of the config
| replace github.com/rancher/go-rancher => github.com/rancher/go-rancher v0.1.0 | ||
|
|
||
| replace k8s.io/api => k8s.io/api v0.34.1 | ||
| replace k8s.io/api => github.com/kubernetes/api v0.0.0-20251107002836-f1737241c064 |
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.
What's the reason behind adding github.com to all k8s dependencies?
|
|
||
| replace k8s.io/externaljwt => k8s.io/externaljwt v0.34.1 | ||
|
|
||
| replace k8s.io/kubernetes => github.com/kubernetes/kubernetes v1.35.0-alpha.3.0.20251107154100-609e2e57dacd |
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.
@towca is that a common practice to update dependencies as part of the PR and not in the context of the release?
In principle I understand that it can be unavoidable, but do we depend on the unmerged branch state in here? @gnufied
That's what I understood based on "This includes relevant changes in k/k repo from - https://github.com/gnufied/kubernetes/tree/volume-limits-redux-cas"
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.
Again, I am going to rebase my branch on top of #8827 . I am hoping the beta-0 rebase merges in CAS code, so as these replaces go away.
| // if cloudprovider does not provide CSI related stuff, then we can skip the CSI readiness check | ||
| if nodeInfo.CSINode == nil { | ||
| newReadyNodes = append(newReadyNodes, node) | ||
| klog.Warningf("No CSI node found for node %s, Skipping CSI readiness check and keeping node in ready list.", node.Name) |
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.
Warning level seems to be extreme due to potential noise level in the logs, or do we anticipate all the nodes to have the matching CsiNode?
|
PR needs rebase. 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. |
xref - kubernetes/enhancements#5030
This makes CAS aware of volume limits on new nodes when scaling for pending pods.
This includes relevant changes in k/k repo from - https://github.com/gnufied/kubernetes/tree/volume-limits-redux-cas
But I have tested the changes together and they work fine.