Skip to content
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

Merged
merged 2 commits into from
Sep 17, 2019

Conversation

adamwg
Copy link
Contributor

@adamwg adamwg commented Sep 13, 2019

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.

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")
Copy link
Contributor Author

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.

Copy link
Collaborator

@jcodybaker jcodybaker left a 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]
Copy link
Collaborator

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.

Copy link
Contributor Author

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.
@adamwg adamwg force-pushed the awg/custom-driver-name-master branch from 63f14a8 to 221481b Compare September 17, 2019 16:48
// 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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@adamwg adamwg merged commit 2ca8c14 into master Sep 17, 2019
@adamwg adamwg deleted the awg/custom-driver-name-master branch September 17, 2019 19:31
adamwg added a commit that referenced this pull request Sep 17, 2019
In #179 we changed the `noformat` annotation to `no-format`, which was
not intentional. Change it back so it works as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants