-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fixed creation of ControllerCreateVolumeRequest. #11238
Conversation
5ab0de4
to
067ccab
Compare
This was discovered in https://gitlab.com/rocketduck/csi-plugin-nfs/-/issues/5 |
067ccab
to
52ea3b2
Compare
Thanks for the fix @apollo13. I'm not too familiar with the CSI spec, but it doesn't seem to dictate any specific behaviour in this scenario:
This issue interprets this as something that is up to each container orchestrator (CO) to decide, which is not great. Kubernetes seems to fail if the volume size is zero, as reported in this issue ceph/ceph-csi#2472, so I would expect most plugins to expect this behaviour from other COs as well. Your approach would push the implementation details to plugins ( |
@lgfa29 Thank you for your response. I am also not sure what the best approach spec-wise would be. That said creating a volume currently fails due to: Lines 487 to 491 in 2998c4b
So either my patch, relaxing the above check or more validation logic around
It would be OK for me to push this to the plugins, then they can perform their own validation as needed. |
Thinking more about it I think the current code in nomad: Lines 233 to 236 in f639f71
is indeed wrong. The spec clearly says that CapacityRange is optional, but if it is set at least one of the fields has to have a value. It also says that "A value of 0 is equal to an unspecified field value." for the fields in CapacityRange . So no matter what the CO or plugin later on does, the nomad clients should never submit a CapacityRange where both fields are zero because that would be a spec violation. As such I think my patch is the correct way and required.
|
`CapacityRange` should only be set if `RequiredBytes` and/or `LimitBytes` are set.
52ea3b2
to
71cfa2f
Compare
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 spec clearly says that CapacityRange is optional, but if it is set at least one of the fields has to have a value. It also says that "A value of 0 is equal to an unspecified field value." for the fields in CapacityRange. So no matter what the CO or plugin later on does, the nomad clients should never submit a CapacityRange where both fields are zero because that would be a spec violation. As such I think my patch is the correct way and required.
Ah good catch, I missed that part from the spec, and that would actually be the behaviour I would expect.
I pushed a commit to document this requirement as a comment in the code and also to fix a small type in the CHANGELOG entry.
Thanks for catching and fixing this!
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
CapacityRange
should only be set ifRequiredBytes
and/orLimitBytes
are set.