-
Notifications
You must be signed in to change notification settings - Fork 108
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
csi: document how to use existing volumes #87
Conversation
driver/controller.go
Outdated
// TODO(arslan): remove this logic once the bug is fixed in k8s | ||
// https: //github.com/kubernetes/kubernetes/issues/65552 | ||
// volume is still attached, but we receive a delete request. Try to detach it. | ||
ll.WithFields(logrus.Fields{ |
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.
FYI: I'm going to remove the whole logic, it's not worth adding this and a wrong approach. Eventually the controllers will reconcile if all methods are idempotent (which is in our case). That's why we don't need this code yet. I'm doing some tests so pushed it here.
@@ -0,0 +1,146 @@ | |||
# Use an existing volume | |||
|
|||
Below you find the instruction on how to use an existing DigitalOcean Block |
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.
Below you will find the instructions
* `volumeAttributes` has a special, csi-digitalocean specific annotation called `com.digitalocean.csi/format`. If you add this key, the CSI plugin make sure to **not format** the volume. If you don't add this, it'll be formatted. | ||
* `storage` make sure it's set to the same storage size as your existing DigitalOcean Block Storage volume. | ||
|
||
Once everything is set, create this file called `pv.yaml` and deploy it: |
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.
create a file with this content, naming it
pv.yaml, and deploy it
lgtm |
@fatih just to confirm on
The expected behaviour here is |
driver/controller.go
Outdated
} | ||
|
||
// we assume it's deleted already for idempotency | ||
if resp.StatusCode == http.StatusNotFound { |
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.
log here. mostly so we know this is happening. ( thinking of a case we end up returning a 404 on api for #reasons )
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.
This also happens if the plugin receives two or more delete calls. The first one deletes it, the second one gets a StatusNotFound
.
lgtm |
For dynamic provisioning, such as when you set a storage class (Which is the case if you deployr our CSI plugin or in DigitalOcean Kubernetes), in this case, the However, in this case, if you manually create a I think this is a bug on K8S. I'll try to reproduce and open a bug issue if I can find something |
// droplet is attached to a different node, return an error | ||
if attachedID != 0 { | ||
return nil, status.Errorf(codes.FailedPrecondition, | ||
"volume is attached to a wrong droplet(%q), dettach the volume to fix it", attachedID) |
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.
volume is attached to the wrong droplet(%q), detach the volume to fix it
@@ -50,7 +51,7 @@ Couple of things to note, | |||
* `volumeAttributes` has a special, csi-digitalocean specific annotation called `com.digitalocean.csi/format`. If you add this key, the CSI plugin make sure to **not format** the volume. If you don't add this, it'll be formatted. | |||
* `storage` make sure it's set to the same storage size as your existing DigitalOcean Block Storage volume. | |||
|
|||
Once everything is set, create this file called `pv.yaml` and deploy it: | |||
Create a file with this content, naming it `pv.yaml` and deploy it: |
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.
deploying
lgtm |
* Add Readme with examples on how to use existing volumes * Add an option to prevent formatting an existing volume (needs more testing) KNOWN ISSUES: * Deleting a `PVC` will delete the volume if the reclaim policy is set to `Delete`, however the `PV` will be not deleted. This seems to be a bug in K8S * Using an existing, attached volume might cause confusion if the POD is scheduled to a different node. It's advised that user only use existing **detached** volumes
00909a5
to
571c5c8
Compare
testing)
KNOWN ISSUES:
PVC
will delete the volume if the reclaim policy is setto
Delete
, however thePV
will be not deleted. This seems to be abug in K8S
scheduled to a different node. It's advised that user only use existing
detached volumes
closes #85