-
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
driver: handle non existing volumes and nodes #60
Conversation
3036d68
to
023f21a
Compare
According to the spec we should return a `NOT_FOUND` in various method. We always assume the volume or node exist, however this might not the case. For example the user might delete the volume externally from the UI or make a HTTP call to the DigitalOcean API to delete the volume. Actions like this are outside the Kubernetes system, so the plugin needs to handle these edge cases by signaling back that the resources don't exist. We return `NOT_FOUND` for any creation actions, such as creating a volume, attaching a volume, formatting, etc.. Because we really need to return an error as there is no way to recover from this We don't return `NOT_FOUND` for any destroy actions, such as deleting, detaching, unmounting, etc.. Because in all these cases it doesn't matter if the volume doesn't exist. There is not much to do and assuming it's "done" makes the overall system more stable
023f21a
to
89c4115
Compare
driver/node.go
Outdated
// Invalid argument is returned by the `mount` command in this container | ||
// image when a path is already umounted. We only return an error for | ||
// anything else | ||
if err != nil && !strings.Contains(err.Error(), "Invalid argument") { |
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.
Mhmm this string comparison feels like it’s a little fragile, is there another way to determine the error case?
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.
Good call, as I said I'll use IsMounted
that doesn't rely on the Source
so it's a safe bet
lgtm, one question about checking the error. |
The |
5087aa3
to
1134850
Compare
1134850
to
8a50f61
Compare
🚀 |
According to the spec we should return a
NOT_FOUND
in various method.We always assume the volume or node exist, however this might not the
case.
For example the user might delete the volume externally from the
UI or make a HTTP call to the DigitalOcean API to delete the volume.
Actions like this are outside the Kubernetes system, so the plugin needs
to handle these edge cases by signaling back that the resources don't
exist.
We return
NOT_FOUND
for any creation actions, such as creating avolume, attaching a volume, formatting, etc.. Because we really need to
return an error as there is no way to recover from this
We don't return
NOT_FOUND
for any destroy actions, such as deleting,detaching, unmounting, etc.. Because in all these cases it doesn't
matter if the volume doesn't exist. There is not much to do and assuming
it's "done" makes the overall system more stable