-
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
Allow a custom driver name to be specified on the commandline #179
Conversation
url = flag.String("url", "https://api.digitalocean.com/", "DigitalOcean API URL") | ||
doTag = flag.String("do-tag", "", "Tag DigitalOcean volumes on Create/Attach") | ||
version = flag.Bool("version", false, "Print the version and exit.") | ||
endpoint = flag.String("endpoint", "unix:///var/lib/kubelet/plugins/"+driver.DefaultDriverName+"/csi.sock", "CSI endpoint") |
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.
Note: We're using the default driver name here, not the commandline-provided one. The endpoint socket path just needs to match what's in the deployment manifest, not the driver name.
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.
LGTM. We should also update the README.
driver/node.go
Outdated
@@ -95,7 +90,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe | |||
"method": "node_stage_volume", | |||
}) | |||
|
|||
_, ok := req.VolumeContext[annNoFormatVolume] | |||
_, ok := req.VolumeContext[d.annNoFormatVolume] |
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.
I wonder if should allow both old and new annotations here. That might make user-facing documentation easier and reduce the pain caused by confusing the two.
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 idea. I've implemented this in the latest push.
I hard-coded the new and legacy driver names for this rather than using the flag - seems sensible given that we're supporting both, but let me know if you have a nicer way to do it.
The name of our CSI driver changed between the 0.2 and 0.4 releases, from `com.digitalocean.csi.dobs` to `dobs.csi.digitalocean.com`. This means that when upgrading a cluster from Kubernetes 1.11 (which uses CSI plugin 0.2) to Kubernetes 1.12 (which uses CSI plugin 0.4) volumes created before the upgrade have the old driver name in various annotations and spec fields. This prevents the new driver from managing the volume, leading to broken workloads. To handle the upgrade case, allow a custom driver name to be specified on the commandline. This way, a cluster that was once running 1.11 and thus uses the old name can continue using the old name. By default the new name will be used.
63f14a8
to
221481b
Compare
// This annotation is added to a PV to indicate that the volume should be | ||
// not formatted. Useful for cases if the user wants to reuse an existing | ||
// volume. | ||
annNoFormatVolume = DriverName + "/noformat" | ||
// volume. We support using either the legacy driver name |
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.
👍
In #179 we changed the `noformat` annotation to `no-format`, which was not intentional. Change it back so it works as before.
The name of our CSI driver changed between the 0.2 and 0.4 releases, from
com.digitalocean.csi.dobs
todobs.csi.digitalocean.com
. This means that when upgrading a cluster from Kubernetes 1.11 (which uses CSI plugin 0.2) to Kubernetes 1.12 (which uses CSI plugin 0.4) volumes created before the upgrade have the old driver name in various annotations and spec fields. This prevents the new driver from managing the volume, leading to broken workloads.To handle the upgrade case, allow a custom driver name to be specified on the commandline. This way, a cluster that was once running 1.11 and thus uses the old name can continue using the old name. By default the new name will be used.