From e4b24711f6dd15da59b2b917d1c62ed78939539b Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Wed, 23 Jan 2019 10:58:50 -0500 Subject: [PATCH 1/6] cope with latest changes in csi provisioner and deprecations --- .../cephfs/kubernetes/csi-cephfsplugin-provisioner.yaml | 3 +-- docs/deploy-cephfs.md | 4 ++-- docs/deploy-rbd.md | 4 ++-- examples/cephfs/storageclass.yaml | 8 ++++---- examples/rbd/storageclass.yaml | 8 ++++---- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/deploy/cephfs/kubernetes/csi-cephfsplugin-provisioner.yaml b/deploy/cephfs/kubernetes/csi-cephfsplugin-provisioner.yaml index 6ee94834b..9f8d04533 100644 --- a/deploy/cephfs/kubernetes/csi-cephfsplugin-provisioner.yaml +++ b/deploy/cephfs/kubernetes/csi-cephfsplugin-provisioner.yaml @@ -27,9 +27,8 @@ spec: serviceAccount: cephfs-csi-provisioner containers: - name: csi-provisioner - image: quay.io/k8scsi/csi-provisioner:v1.0.0 + image: quay.io/k8scsi/csi-provisioner:canary args: - - "--provisioner=csi-cephfsplugin" - "--csi-address=$(ADDRESS)" - "--v=5" env: diff --git a/docs/deploy-cephfs.md b/docs/deploy-cephfs.md index 7c389dab9..f15bb650c 100644 --- a/docs/deploy-cephfs.md +++ b/docs/deploy-cephfs.md @@ -43,8 +43,8 @@ Parameter | Required | Description `provisionVolume` | yes | Mode of operation. BOOL value. If `true`, a new CephFS volume will be provisioned. If `false`, an existing volume will be used. `pool` | for `provisionVolume=true` | Ceph pool into which the volume shall be created `rootPath` | for `provisionVolume=false` | Root path of an existing CephFS volume -`csiProvisionerSecretName`, `csiNodeStageSecretName` | for Kubernetes | name of the Kubernetes Secret object containing Ceph client credentials. Both parameters should have the same value -`csiProvisionerSecretNamespace`, `csiNodeStageSecretNamespace` | for Kubernetes | namespaces of the above Secret objects +`csi.storage.k8s.io/provisioner-secret-name`, `csi.storage.k8s.io/node-stage-secret-name` | for Kubernetes | name of the Kubernetes Secret object containing Ceph client credentials. Both parameters should have the same value +`csi.storage.k8s.io/provisioner-secret-namespace`, `csi.storage.k8s.io/node-stage-secret-namespace` | for Kubernetes | namespaces of the above Secret objects **Required secrets for `provisionVolume=true`:** Admin credentials are required for provisioning new volumes diff --git a/docs/deploy-rbd.md b/docs/deploy-rbd.md index 66163334e..2def48638 100644 --- a/docs/deploy-rbd.md +++ b/docs/deploy-rbd.md @@ -44,8 +44,8 @@ Parameter | Required | Description `pool` | yes | Ceph pool into which the RBD image shall be created `imageFormat` | no | RBD image format. Defaults to `2`. See [man pages](http://docs.ceph.com/docs/mimic/man/8/rbd/#cmdoption-rbd-image-format) `imageFeatures` | no | RBD image features. Available for `imageFormat=2`. CSI RBD currently supports only `layering` feature. See [man pages](http://docs.ceph.com/docs/mimic/man/8/rbd/#cmdoption-rbd-image-feature) -`csiProvisionerSecretName`, `csiNodePublishSecretName` | for Kubernetes | name of the Kubernetes Secret object containing Ceph client credentials. Both parameters should have the same value -`csiProvisionerSecretNamespace`, `csiNodePublishSecretNamespace` | for Kubernetes | namespaces of the above Secret objects +`csi.storage.k8s.io/provisioner-secret-name`, `csi.storage.k8s.io/node-publish-secret-name` | for Kubernetes | name of the Kubernetes Secret object containing Ceph client credentials. Both parameters should have the same value +`csi.storage.k8s.io/provisioner-secret-namespace`, `csi.storage.k8s.io/node-publish-secret-namespace` | for Kubernetes | namespaces of the above Secret objects `mounter`| no | if set to `rbd-nbd`, use `rbd-nbd` on nodes that have `rbd-nbd` and `nbd` kernel modules to map rbd images **Required secrets:** diff --git a/examples/cephfs/storageclass.yaml b/examples/cephfs/storageclass.yaml index 1ed336c22..c23814322 100644 --- a/examples/cephfs/storageclass.yaml +++ b/examples/cephfs/storageclass.yaml @@ -25,10 +25,10 @@ parameters: # rootPath: /absolute/path # The secrets have to contain user and/or Ceph admin credentials. - csiProvisionerSecretName: csi-cephfs-secret - csiProvisionerSecretNamespace: default - csiNodeStageSecretName: csi-cephfs-secret - csiNodeStageSecretNamespace: default + csi.storage.k8s.io/provisioner-secret-name: csi-cephfs-secret + csi.storage.k8s.io/provisioner-secret-namespace: default + csi.storage.k8s.io/node-stage-secret-name: csi-cephfs-secret + csi.storage.k8s.io/node-stage-secret-namespace: default # (optional) The driver can use either ceph-fuse (fuse) or ceph kernel client (kernel) # If omitted, default volume mounter will be used - this is determined by probing for ceph-fuse diff --git a/examples/rbd/storageclass.yaml b/examples/rbd/storageclass.yaml index 98960a53d..d1a568ce7 100644 --- a/examples/rbd/storageclass.yaml +++ b/examples/rbd/storageclass.yaml @@ -24,10 +24,10 @@ parameters: imageFeatures: layering # The secrets have to contain Ceph admin credentials. - csiProvisionerSecretName: csi-rbd-secret - csiProvisionerSecretNamespace: default - csiNodePublishSecretName: csi-rbd-secret - csiNodePublishSecretNamespace: default + csi.storage.k8s.io/provisioner-secret-name: csi-rbd-secret + csi.storage.k8s.io/provisioner-secret-namespace: default + csi.storage.k8s.io/node-publish-secret-name: csi-rbd-secret + csi.storage.k8s.io/node-publish-secret-namespace: default # Ceph users for operating RBD adminid: admin From 6263b9cdb5a473636f133448272652bec4b8db8a Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 4 Feb 2019 10:44:00 +0530 Subject: [PATCH 2/6] megacheck is not present in gometalinter v3.0.0 added staticheck option for gometalinter Signed-off-by: Madhu Rajanna --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3b12f179e..0e5d8aa53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ before_script: - GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/) script: - - gometalinter --deadline=10m -j 4 --enable=megacheck --enable=misspell --vendor ./... + - gometalinter --deadline=10m -j 4 --enable=misspell --enable=staticcheck --vendor ./... - test -z $(gofmt -s -l $GO_FILES) - make rbdplugin - make cephfsplugin From 5983fedddb933586211431a8d7b3f74b8d74fd4e Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 4 Feb 2019 10:44:37 +0530 Subject: [PATCH 3/6] Fix issues found in gometalinter static check Signed-off-by: Madhu Rajanna --- pkg/cephfs/volumeoptions.go | 10 +++++----- pkg/rbd/controllerserver.go | 4 ++-- pkg/rbd/rbd_attach.go | 2 +- pkg/rbd/rbd_util.go | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/cephfs/volumeoptions.go b/pkg/cephfs/volumeoptions.go index 7ce6e86b3..eb092accf 100644 --- a/pkg/cephfs/volumeoptions.go +++ b/pkg/cephfs/volumeoptions.go @@ -34,7 +34,7 @@ type volumeOptions struct { func validateNonEmptyField(field, fieldName string) error { if field == "" { - return fmt.Errorf("Parameter '%s' cannot be empty", fieldName) + return fmt.Errorf("parameter '%s' cannot be empty", fieldName) } return nil @@ -53,7 +53,7 @@ func (o *volumeOptions) validate() error { } } else { if o.ProvisionVolume { - return fmt.Errorf("Non-empty field rootPath is in conflict with provisionVolume=true") + return fmt.Errorf("non-empty field rootPath is in conflict with provisionVolume=true") } } @@ -75,7 +75,7 @@ func (o *volumeOptions) validate() error { func extractOption(dest *string, optionLabel string, options map[string]string) error { opt, ok := options[optionLabel] if !ok { - return fmt.Errorf("Missing required field %s", optionLabel) + return fmt.Errorf("missing required field %s", optionLabel) } *dest = opt @@ -87,7 +87,7 @@ func validateMounter(m string) error { case volumeMounterFuse: case volumeMounterKernel: default: - return fmt.Errorf("Unknown mounter '%s'. Valid options are 'fuse' and 'kernel'", m) + return fmt.Errorf("unknown mounter '%s'. Valid options are 'fuse' and 'kernel'", m) } return nil @@ -134,7 +134,7 @@ func extractNewVolOpt(opts *volumeOptions, volOpt map[string]string) error { } if opts.ProvisionVolume, err = strconv.ParseBool(provisionVolumeBool); err != nil { - return fmt.Errorf("Failed to parse provisionVolume: %v", err) + return fmt.Errorf("failed to parse provisionVolume: %v", err) } if opts.ProvisionVolume { diff --git a/pkg/rbd/controllerserver.go b/pkg/rbd/controllerserver.go index 334f2f3a0..04db9a1bc 100644 --- a/pkg/rbd/controllerserver.go +++ b/pkg/rbd/controllerserver.go @@ -338,7 +338,7 @@ func (cs *ControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS return nil, status.Errorf(codes.NotFound, "Source Volume ID %s cannot found", req.GetSourceVolumeId()) } if !hasSnapshotFeature(rbdVolume.ImageFeatures) { - return nil, fmt.Errorf("Volume(%s) has not snapshot feature(layering)", req.GetSourceVolumeId()) + return nil, fmt.Errorf("volume(%s) has not snapshot feature(layering)", req.GetSourceVolumeId()) } rbdSnap.VolName = rbdVolume.VolName @@ -437,7 +437,7 @@ func (cs *ControllerServer) doSnapshot(rbdSnap *rbdSnapshot, secret map[string]s if err != nil { return fmt.Errorf("snapshot is created but failed to protect and delete snapshot: %v", err) } - return fmt.Errorf("Snapshot is created but failed to protect snapshot") + return fmt.Errorf("snapshot is created but failed to protect snapshot") } } return nil diff --git a/pkg/rbd/rbd_attach.go b/pkg/rbd/rbd_attach.go index 45bc22792..b593d0820 100644 --- a/pkg/rbd/rbd_attach.go +++ b/pkg/rbd/rbd_attach.go @@ -299,7 +299,7 @@ func createPath(volOpt *rbdVolume, userID string, creds map[string]string) (stri } devicePath, found := waitForPath(volOpt.Pool, image, 10, useNBD) if !found { - return "", fmt.Errorf("Could not map image %s, Timeout after 10s", imagePath) + return "", fmt.Errorf("could not map image %s, Timeout after 10s", imagePath) } return devicePath, nil } diff --git a/pkg/rbd/rbd_util.go b/pkg/rbd/rbd_util.go index 3e1b6f770..84d053a41 100644 --- a/pkg/rbd/rbd_util.go +++ b/pkg/rbd/rbd_util.go @@ -231,13 +231,13 @@ func getRBDVolumeOptions(volOptions map[string]string) (*rbdVolume, error) { rbdVol := &rbdVolume{} rbdVol.Pool, ok = volOptions["pool"] if !ok { - return nil, fmt.Errorf("Missing required parameter pool") + return nil, fmt.Errorf("missing required parameter pool") } rbdVol.Monitors, ok = volOptions["monitors"] if !ok { // if mons are not set in options, check if they are set in secret if rbdVol.MonValueFromSecret, ok = volOptions["monValueFromSecret"]; !ok { - return nil, fmt.Errorf("Either monitors or monValueFromSecret must be set") + return nil, fmt.Errorf("either monitors or monValueFromSecret must be set") } } rbdVol.ImageFormat, ok = volOptions["imageFormat"] @@ -283,13 +283,13 @@ func getRBDSnapshotOptions(snapOptions map[string]string) (*rbdSnapshot, error) rbdSnap := &rbdSnapshot{} rbdSnap.Pool, ok = snapOptions["pool"] if !ok { - return nil, fmt.Errorf("Missing required parameter pool") + return nil, fmt.Errorf("missing required parameter pool") } rbdSnap.Monitors, ok = snapOptions["monitors"] if !ok { // if mons are not set in options, check if they are set in secret if rbdSnap.MonValueFromSecret, ok = snapOptions["monValueFromSecret"]; !ok { - return nil, fmt.Errorf("Either monitors or monValueFromSecret must be set") + return nil, fmt.Errorf("either monitors or monValueFromSecret must be set") } } rbdSnap.AdminID, ok = snapOptions["adminid"] From 9ba501617d26e3042a4902662cbc1767ba65c2f1 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 4 Feb 2019 14:17:01 +0530 Subject: [PATCH 4/6] update sidecar images to stable version (v1.0.1) Fixes: #157 Signed-off-by: Madhu Rajanna --- deploy/rbd/kubernetes/csi-rbdplugin-attacher.yaml | 2 +- deploy/rbd/kubernetes/csi-rbdplugin-provisioner.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/rbd/kubernetes/csi-rbdplugin-attacher.yaml b/deploy/rbd/kubernetes/csi-rbdplugin-attacher.yaml index f14172831..276de3698 100644 --- a/deploy/rbd/kubernetes/csi-rbdplugin-attacher.yaml +++ b/deploy/rbd/kubernetes/csi-rbdplugin-attacher.yaml @@ -27,7 +27,7 @@ spec: serviceAccount: rbd-csi-attacher containers: - name: csi-rbdplugin-attacher - image: quay.io/k8scsi/csi-attacher:v1.0.0 + image: quay.io/k8scsi/csi-attacher:v1.0.1 args: - "--v=5" - "--csi-address=$(ADDRESS)" diff --git a/deploy/rbd/kubernetes/csi-rbdplugin-provisioner.yaml b/deploy/rbd/kubernetes/csi-rbdplugin-provisioner.yaml index 305b6f46c..d56786fa3 100644 --- a/deploy/rbd/kubernetes/csi-rbdplugin-provisioner.yaml +++ b/deploy/rbd/kubernetes/csi-rbdplugin-provisioner.yaml @@ -27,7 +27,7 @@ spec: serviceAccount: rbd-csi-provisioner containers: - name: csi-provisioner - image: quay.io/k8scsi/csi-provisioner:canary + image: quay.io/k8scsi/csi-provisioner:v1.0.1 args: - "--csi-address=$(ADDRESS)" - "--v=5" From 419117c8c23693321fd3981125236b10c41d475e Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 4 Feb 2019 11:01:43 +0530 Subject: [PATCH 5/6] install gometalinter in $GOPATH/bin update gometalinter to stable v3.0.0 Signed-off-by: Madhu Rajanna --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0e5d8aa53..5031b46f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,16 @@ branches: go: 1.11.x +env: + global: + - GO_METALINTER_VERSION="v3.0.0" + install: - - curl -L https://git.io/vp6lP | sh + # install gometalinter + - > + curl -L + 'https://github.com/alecthomas/gometalinter/blob/v3.0.0/scripts/install.sh' + | bash -s -- -b $GOPATH/bin "${GO_METALINTER_VERSION}" before_script: - GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/) From 3132130e83119f19ce79b1a80504475923c13183 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 4 Feb 2019 19:41:41 +0530 Subject: [PATCH 6/6] Fix CI failure for gometalinter Signed-off-by: Madhu Rajanna --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5031b46f2..729f3dc61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,9 +15,8 @@ env: install: # install gometalinter - - > - curl -L - 'https://github.com/alecthomas/gometalinter/blob/v3.0.0/scripts/install.sh' + - curl -L + "https://raw.githubusercontent.com/alecthomas/gometalinter/"${GO_METALINTER_VERSION}"/scripts/install.sh" | bash -s -- -b $GOPATH/bin "${GO_METALINTER_VERSION}" before_script: