-
Notifications
You must be signed in to change notification settings - Fork 59
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: limit should always be the total #310
Conversation
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.
Hi, Could provide more context behind this change and the reason?
hi @komer3 Basically, when your node has a limit of 8 and has 8 PV mounted, it reports Here CSI driver seems to try to replace scheduler decision :) I'm also adding GCP CSI code to compare: |
Is it possible that a Linode could have block storage attachments outside of those managed by the CSI driver? I don't think this is possible via CAPL provisioned machines for example. |
Yes, I see in tests that is it expect 7 on empty nodes. |
Ah I see. Thanks for providing the context! We don't want to completely remove the listInstanceDisk() call. Reason for that being 8gb nodes can only have 7 additional pvc attached with 1 disk for boot that comes with it (listInstanceDisk will return more than 1 if we have some pvcs attached to that node). We want to provide exact number for allowed volume attachments in that given time. If we remove that logic, we would be returning theoretical max volume attachment number which would be incorrect representation of how many volumes can be attached. This will result in more errors with scheduling I believe. For more context on why we have this logic please check this issue: #182 And check the corresponding PR here: #184 |
Actually, let me correct myself here, swap disk also counts towards the total allowed disk attachment limit. From akamai tech docs (https://techdocs.akamai.com/cloud-computing/docs/block-storage#limits-and-considerations): Anyway, I think the problem we need to solve here is when we have no more space for disk attachment, we see the value being set to 0 which is may be incorrect. Do we know an alternative value (other than 0) that indicates to the CO that we can no longer schedule workloads with pvc for that particular node (no more room for attachments)? I haven't been able to find it. |
af014ae
to
f596131
Compare
@komer3 I change myself and correct using prefix to filter PV from our driver :) |
internal/driver/nodeserver.go
Outdated
// Filter out disks that are created by the driver | ||
// to avoid counting them towards the max volume attachments | ||
// that can be attached to the instance. | ||
filterdDisks := slices.DeleteFunc(disks, func(disk linodego.InstanceDisk) bool { | ||
// Check if the disk label starts with the volume label prefix | ||
return strings.HasPrefix(disk.Label, ns.driver.volumeLabelPrefix) | ||
}) |
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'm not sure if we want to filter out the volume that are attached to the node here. This would result in incorrect number of volumes that can be further attached. No?
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.
The CSI spec is unfortunately not as explicit as it could be. However, it seems intended that you return the maximum # of volumes that can be attached (irrespective of how many volumes are currently attached).
Example of the AWS EBS CSI driver calculating the volume limit
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.
You can see here that the kube-scheduler calculates how many volumes are currently attached and compares that to the limit (which we return here) of how many total volumes can be attached.
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.
Ah good catch. Thanks for sharing that. Yeah looking into it further I agree with you. We should make sure that we do not count for attached volumes (only the disks - boot and swap or just boot in LKE).
But I believe we are doing that correctly already. ListInstanceDisk() only return the disks and do not include the volumes attached to the node. So we don't really need to filter for it.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #310 +/- ##
=======================================
Coverage 74.79% 74.79%
=======================================
Files 22 22
Lines 2396 2396
=======================================
Hits 1792 1792
Misses 499 499
Partials 105 105 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
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.
Good catch recognizing that we were implementing the CSI spec incorrectly and not returning a consistent maximum number of volumes that can be attached!
Example of AWS's EBS CSI driver calculating the volume limit, for the curious
// Filter out disks that are created by the driver | ||
// to avoid counting them towards the max volume attachments | ||
// that can be attached to the instance. | ||
filterdDisks := slices.DeleteFunc(disks, func(disk linodego.InstanceDisk) bool { |
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.
filterdDisks := slices.DeleteFunc(disks, func(disk linodego.InstanceDisk) bool { | |
filteredDisks := slices.DeleteFunc(disks, func(disk linodego.InstanceDisk) bool { |
Typo here (and other locations where the variable is referenced)
when node have maximum number of pvc it report 0, which is no limit.
https://github.com/container-storage-interface/spec/blob/master/spec.md#nodegetinfo
General:
Pull Request Guidelines: