-
Notifications
You must be signed in to change notification settings - Fork 63
refactor: remove capacity checking when attaching #312
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
Conversation
|
||
// maxAllowedVolumeAttachments calculates the maximum number of volumes that can be attached to a Linode instance, | ||
// taking into account the instance's memory and currently attached disks. | ||
func (cs *ControllerServer) maxAllowedVolumeAttachments(ctx context.Context, instance *linodego.Instance) (int, 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.
You can also remove this helper func(). Its not used anywhere else except the funcs you are removing :)
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 agree with this proposal. This will definitely simplify the volume attachment logic (great for us when debugging and understanding what is happening).
Just to make sure we aren't missing any cases, we should test the CSI driver by running the all the e2e tests we have plus run manual test to see how CSI driver handles things when we hit the max limit.
@wbh1 totally. |
Also fix already mount error code
d0a111c
to
6f49ca5
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #312 +/- ##
=======================================
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. |
duplicate #322 |
This pull request focuses on simplifying the volume attachment logic in the
ControllerServer
by removing redundant checks and related methods. The most important changes include the removal of thecheckAttachmentCapacity
function and its associated methods, as well as the related test cases.Context
CSI caller (like Kubernetes) should already respect volume limitation from
NodeGetInfo
.We don't need another check and logic at attach.
Motivation
Reduce logic and complexity and rely more on Linode API calls.
If there is an error, return it to the user for easier debug.
Risk
Making more failing attach requests and maybe hitting a rate limit.
This should not be a problem, as CSI attacher have a backoff logic.
Moreover, current limit logic is already doing api calls that should have hit API ratelimit.
Possible Mitigations
csiErrorBackoff
mechanismIMHO, both are not mandatory for the moment.
Simplification of volume attachment logic:
checkAttachmentCapacity
function and its invocation from theControllerPublishVolume
method ininternal/driver/controllerserver.go
.canAttach
function, which was used to determine if an additional volume could be attached to an instance, frominternal/driver/controllerserver_helper.go
.checkAttachmentCapacity
function, which checked if an instance could accommodate additional volume attachments, frominternal/driver/controllerserver_helper.go
.Removal of related test cases:
TestCheckAttachmentCapacity
test function frominternal/driver/controllerserver_helper_test.go
, which tested thecheckAttachmentCapacity
logic.General:
Pull Request Guidelines: