-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[WIP] Add block volume support check to external provisioners #787
Conversation
I think all of the provisioners in this repo should reject Since every single provisioner needs this check, this raises a question...would it be better to add a method like |
Thank you for your comment.
IIUC, all the provisioners which can support volumeMode: block should set volume mode for PV just as iSCSI provisioner does in below code. Also, similar codes are added to internal provisioners. Therefore, we should leave a room for some of the external provisioners to make volumeMode: block accept.
Please see below discussion for it. I thinks that there are four options:
As it is implemented by option 2 in internal provisioner, I implemented in the similar way for external provisioner in this PR. I think it would be better to discuss again for internal provisioner if we choose option 1 for external provisioner.
I agree with you that doing it in library is better if there is a way that each provisioner doesn't need to do it, so I was investigating a little bit for #3 and #4, but I can't find a good way. Note that as I commented, how flexvolume should handle this is not solved in this PR, because it could be supported or unsupported, depending on the backend storage. On the other hand, I found that CSI seems to have a plan to prepare an interface to specify block in CreateVolume() call. VolumeCapability in CreateVolumeRequest has BlockVolume field. So, we will be able to check if it supports block, by checking CreateVolume() with BlockVolume fails. Therefore, for CSI, just regarding it as supported and calling provision() would be fine, if CreateVolume() properly handles BlockVolume. |
You're correct, I misunderstood, I thought the provisioners would have to do something with VolumeMode but of course it's actually kube that does something (don't create an fs, etc.) and provisioners just need to set it. So not every one should be false. Correct me if I'm wrong, but flexvolume doesn't have a 'Map' call in its interface so isn't block always unsupported for flex, i.e. it is not a BlockVolumePlugin? If so then we should set it snapshot should be I agree about option 3 and 4, I can think of no way to do them nicely. I still lean toward option 1 even if it means we differ from internal. For internal plugins, it is much easier to audit and ensure everybody is copying the volumeMode or rejecting it as appropriate. For external, it is impossible to ensure authors are dealing with new fields appropriately, unless we force them to deal with it when they update the library by adding functions to the interface. (Assuming they even update the library). Internal, the Provisioner interface is simply Provision and I sympathize that he does not want to introduce many ugly little SupportsX functions. External, the Provisioner interface is basically the entire library and is already more complicated than just Provision, so I have no qualms with adding more functions to it. And yeah, about CSI, saying supported then calling CreateVolume is fine. Thanks for your thoughts on this matter, I'm still not certain how to proceed but :) (BTW again, your linked comment raised a good point about SupportsMountOption, we should have that here as well! I have missed so many of these things...) |
Thank you for your comment. @wongma7
Oh, you're right. Current flex doesn't have block feature, so we can safely make it unsupported.
I'm afraid that there is a possibility to create a snapshot for block devices and restore block volumes from it, in the future. It seems that most of plugins for snapshot don't rely on filesystem when creating/restoring a snapshot, so they should be able to do it. However, again, current snapshot doesn't support block volume, so I agree to make it false until it supports block volume. (Snapshot will only support CSI and CSI will be able to handle provisioning block safely, as we discussed, so provision() for snapshot might just need to set block for its volumeMode there, however, it would be better to keep it false until CSI provisioner for block is properly implemented and we are 100% sure that it works well. )
Thank you for your explanation on the difference between external and internal. It makes sense to me to make some interfaces to library in order to keep compatibility for external plugins.
I will implement a prototype for option 1 and then let's review both codes. It would be easier to compare them with the actual codes. |
I've implemented option 1 as below. PTAL This implementation looks much simpler and doesn't require any changes to existing plugins that doesn't support block volume. Please also see the test logs below for how it behave:
[Block supported case]
[Block unsupported case] (Tested by deleting SupportsBlock() or changing SupportsBlock() to return false in iscsi/targetd/provisioner/iscsi-provisioner.go.)
|
Yes I like that code quite a bit more, it lgtm. Behaviour is good. Since somebody already added the Qualifier interface there is some precedent for doing it this way too. And it kind of reminds me of upstream 'BlockVolumePlugin', 'XVolumePlugin', to say 'BlockProvisioner'. |
Closing this PR for this issue is resolved by #830 |
Adding the similar check logic to below PR for external provisioners which don't support block volume.
Add block volume support to internal provisioners. kubernetes/kubernetes#64447
There could be many other external provisioners that are not in this git repository, however it would be better adding check to the ones in this git repository.
Not all external provisioner are tested currently, however, comments for this PR is welcomed.
Please review the code with below in mind:
[Unknown/Needdiscussion]
[Support block volume]
[Not Support block volume]