mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-11 22:10:11 +01:00
feat(zfspv): pvc should be bound only if volume has been created.
The controller does not check whether the volume has been created or not and return successful. Which in turn binds the pvc to the pv. The PVC should not bound until corresponding zfs volume has been created. Now controller will check the ZFSVolume CR state to be "Ready" before returning successful. The CSI will retry the CreateVolume request when it will get a error reply and when the ZFS node agent creates the ZFS volume and sets the ZFSVolume CR state to be "Ready", the controller will return success for the CreateVolume Request and then PVC will be bound. Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
parent
9118f56600
commit
25d1f1a413
13 changed files with 150 additions and 5 deletions
|
|
@ -100,6 +100,18 @@ func (c *FakeZFSVolumes) Update(zFSVolume *v1alpha1.ZFSVolume) (result *v1alpha1
|
|||
return obj.(*v1alpha1.ZFSVolume), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeZFSVolumes) UpdateStatus(zFSVolume *v1alpha1.ZFSVolume) (*v1alpha1.ZFSVolume, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(zfsvolumesResource, "status", c.ns, zFSVolume), &v1alpha1.ZFSVolume{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ZFSVolume), err
|
||||
}
|
||||
|
||||
// Delete takes name of the zFSVolume and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeZFSVolumes) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ type ZFSVolumesGetter interface {
|
|||
type ZFSVolumeInterface interface {
|
||||
Create(*v1alpha1.ZFSVolume) (*v1alpha1.ZFSVolume, error)
|
||||
Update(*v1alpha1.ZFSVolume) (*v1alpha1.ZFSVolume, error)
|
||||
UpdateStatus(*v1alpha1.ZFSVolume) (*v1alpha1.ZFSVolume, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*v1alpha1.ZFSVolume, error)
|
||||
|
|
@ -132,6 +133,22 @@ func (c *zFSVolumes) Update(zFSVolume *v1alpha1.ZFSVolume) (result *v1alpha1.ZFS
|
|||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *zFSVolumes) UpdateStatus(zFSVolume *v1alpha1.ZFSVolume) (result *v1alpha1.ZFSVolume, err error) {
|
||||
result = &v1alpha1.ZFSVolume{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("zfsvolumes").
|
||||
Name(zFSVolume.Name).
|
||||
SubResource("status").
|
||||
Body(zFSVolume).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the zFSVolume and deletes it. Returns an error if one occurs.
|
||||
func (c *zFSVolumes) Delete(name string, options *v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue