Skip to content

Commit

Permalink
csi: fix incosistent driver name usages
Browse files Browse the repository at this point in the history
Our driver name has changed from `com.digitalocean.csi.dobs` to
`dobs.csi.digitalocean.com` because of the upcoming changes to the CSI
spec that decided to follow a forward domain notation instead of reverse
domain notation.

Seems like the names were incorrect in many places and we also forget to
update it in various places. I made sure to export `driver.DriverName`
and use that variable everywhere in the code. So in the future, if we
need to change it again, we'll make sure it's updated correctly from a
single place.
  • Loading branch information
fatih committed Nov 9, 2018
1 parent ac7f850 commit c4e6e20
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## unreleased

* Fix inconsistent usage of the driver name
[[GH-100]](https:/digitalocean/csi-digitalocean/pull/100)
* Use publish_info in ControllerPublishVolume for storing and accessing the
volume name on Node plugins. This allows us to do all Node related operations
without relying on the DO API.
Expand Down
2 changes: 1 addition & 1 deletion cmd/do-csi-plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

func main() {
var (
endpoint = flag.String("endpoint", "unix:///var/lib/kubelet/plugins/com.digitalocean.csi.dobs/csi.sock", "CSI endpoint")
endpoint = flag.String("endpoint", "unix:///var/lib/kubelet/plugins/"+driver.DriverName+"/csi.sock", "CSI endpoint")
token = flag.String("token", "", "DigitalOcean access token")
url = flag.String("url", "https://api.digitalocean.com/", "DigitalOcean API URL")
version = flag.Bool("version", false, "Print the version and exit.")
Expand Down
7 changes: 6 additions & 1 deletion driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@ const (
)

const (
PublishInfoVolumeName = "com.digitalocean.csi/volume-name"
// PublishInfoVolumeName is used to pass the volume name from
// `ControllerPublishVolume` to `NodeStageVolume or `NodePublishVolume`
PublishInfoVolumeName = DriverName + "/volume-name"

// defaultVolumeSizeInGB is used when the user didn't defined a correct
// storage size or if the size is not satisfised
defaultVolumeSizeInGB = 16 * GB

// createdByDO is used to tag volumes that are created by this CSI plugin
createdByDO = "Created by DigitalOcean CSI driver"
)

Expand Down
4 changes: 3 additions & 1 deletion driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ import (
)

const (
driverName = "dobs.csi.digitalocean.com"
// DriverName defines the name that is used in Kubernetes and the CSI
// system for the canonical, official name of this plugin
DriverName = "dobs.csi.digitalocean.com"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion driver/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
// GetPluginInfo returns metadata of the plugin
func (d *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
resp := &csi.GetPluginInfoResponse{
Name: driverName,
Name: DriverName,
VendorVersion: version,
}

Expand Down
2 changes: 1 addition & 1 deletion driver/node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/kubernetes/pod-single-existing-volume/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ metadata:
annotations:
# fake it by indicating this is provisioned dynamically, so the system
# works properly
pv.kubernetes.io/provisioned-by: com.digitalocean.csi.dobs
pv.kubernetes.io/provisioned-by: dobs.csi.digitalocean.com
spec:
storageClassName: do-block-storage
# by default, the volume will be not deleted if you delete the PVC, change to
Expand All @@ -38,7 +38,7 @@ spec:
accessModes:
- ReadWriteOnce
csi:
driver: com.digitalocean.csi.dobs
driver: dobs.csi.digitalocean.com
fsType: ext4
volumeHandle: 1952d58a-c714-11e8-bc0c-0a58ac14421e
volumeAttributes:
Expand Down
4 changes: 2 additions & 2 deletions examples/kubernetes/pod-single-existing-volume/pv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
annotations:
# fake it by indicating this is provisioned dynamically, so the system
# works properly
pv.kubernetes.io/provisioned-by: com.digitalocean.csi.dobs
pv.kubernetes.io/provisioned-by: dobs.csi.digitalocean.com
spec:
storageClassName: do-block-storage
# by default, the volume will be not deleted if you delete the PVC, change to
Expand All @@ -16,7 +16,7 @@ spec:
accessModes:
- ReadWriteOnce
csi:
driver: com.digitalocean.csi.dobs
driver: dobs.csi.digitalocean.com
fsType: ext4
volumeHandle: 1952d58a-c714-11e8-bc0c-0a58ac14421e
volumeAttributes:
Expand Down

0 comments on commit c4e6e20

Please sign in to comment.