Repository: rook/rook
Pull request #5289 (2020-04-20 09:29:12)

CSI: update cephcsi to v2.1.0
<!-- Please take a look at our [Contributing](https://rook.io/docs/rook/master/development-flow.html)
documentation before submitting a Pull Request!
Thank you for contributing to Rook! -->

**Description of your changes:**

cephcsi v2.1.0 is released and doesn't need any deployment template changes. This PR updates the cephcsi image version to v2.1.0

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>

**Which issue is resolved by this Pull Request:**
Resolves https://github.com/rook/rook/issues/4914

**Checklist:**

- [ ] **CommitLint Bot**: Commit titles and messages follow guidelines in the [developer guide](https://rook.io/docs/rook/master/development-flow.html#commit-structure).
- [ ] **Skip Tests for Docs**: Add the flag for skipping the build if this is only a documentation change. See [here](https://github.com/rook/rook/blob/master/INSTALL.md#skip-ci) for the flag.
- [ ] **Skip Unrelated Tests**: Add a flag to run tests for a specific storage provider. See [test options](https://github.com/rook/rook/blob/master/INSTALL.md#test-storage-provider).
- [ ] Reviewed the developer guide on [Submitting a Pull Request](https://rook.io/docs/rook/master/development-flow.html#submitting-a-pull-request)
- [ ] Documentation has been updated, if necessary.
- [ ] Unit tests have been added, if necessary.
- [ ] Integration tests have been added, if necessary.
- [ ] Pending release notes updated with breaking and/or notable changes, if necessary.
- [ ] Upgrade from previous release is tested and upgrade user guide is updated, if necessary.
- [ ] Code generation (`make codegen`) has been run to update object specifications, if necessary.
[test ceph]
[test full]


Patch:
diff --git a/Documentation/helm-operator.md b/Documentation/helm-operator.md
index 926e5afff..d507294d2 100644
--- a/Documentation/helm-operator.md
+++ b/Documentation/helm-operator.md
@@ -132,7 +132,7 @@ The following tables lists the configurable parameters of the rook-operator char
 | `csi.enableSnapshotter`            | Enable deployment of snapshotter container in ceph-csi provisioner.                                                         | `true`                                                 |
 | `csi.forceCephFSKernelClient`      | Enable Ceph Kernel clients on kernel < 4.17 which support quotas for Cephfs.                                                | `true`                                                 |
 | `csi.kubeletDirPath`               | Kubelet root directory path (if the Kubelet uses a different path for the `--root-dir` flag)                                | `/var/lib/kubelet`                                     |
-| `csi.cephcsi.image`                | Ceph CSI image.                                                                                                             | `quay.io/cephcsi/cephcsi:v2.0.0`                       |
+| `csi.cephcsi.image`                | Ceph CSI image.                                                                                                             | `quay.io/cephcsi/cephcsi:v2.1.0`                       |
 | `csi.rbdPluginUpdateStrategy`      | CSI Rbd plugin daemonset update strategy, supported values are OnDelete and RollingUpdate.                                  | `OnDelete`                                             |
 | `csi.cephFSPluginUpdateStrategy`   | CSI CephFS plugin daemonset update strategy, supported values are OnDelete and RollingUpdate.                               | `OnDelete`                                             |
 | `csi.registrar.image`              | Kubernetes CSI registrar image.                                                                                             | `quay.io/k8scsi/csi-node-driver-registrar:v1.2.0`      |
diff --git a/cluster/charts/rook-ceph/values.yaml b/cluster/charts/rook-ceph/values.yaml
index f9b87b695..cf193d641 100644
--- a/cluster/charts/rook-ceph/values.yaml
+++ b/cluster/charts/rook-ceph/values.yaml
@@ -94,7 +94,7 @@ csi:
   #rbdLivenessMetricsPort: 9080
   #kubeletDirPath: /var/lib/kubelet
   #cephcsi:
-    #image: quay.io/cephcsi/cephcsi:v2.0.1
+    #image: quay.io/cephcsi/cephcsi:v2.1.0
   #registrar:
     #image: quay.io/k8scsi/csi-node-driver-registrar:v1.2.0
   #provisioner:
diff --git a/cluster/examples/kubernetes/ceph/operator-openshift.yaml b/cluster/examples/kubernetes/ceph/operator-openshift.yaml
index 1c003d4a3..aa0a2c1e4 100644
--- a/cluster/examples/kubernetes/ceph/operator-openshift.yaml
+++ b/cluster/examples/kubernetes/ceph/operator-openshift.yaml
@@ -122,7 +122,7 @@ data:
   # The default version of CSI supported by Rook will be started. To change the version
   # of the CSI driver to something other than what is officially supported, change
   # these images to the desired release of the CSI driver.
-  # ROOK_CSI_CEPH_IMAGE: "quay.io/cephcsi/cephcsi:v2.0.1"
+  # ROOK_CSI_CEPH_IMAGE: "quay.io/cephcsi/cephcsi:v2.1.0"
   # ROOK_CSI_REGISTRAR_IMAGE: "quay.io/k8scsi/csi-node-driver-registrar:v1.2.0"
   # ROOK_CSI_RESIZER_IMAGE: "quay.io/k8scsi/csi-resizer:v0.4.0"
   # ROOK_CSI_PROVISIONER_IMAGE: "quay.io/k8scsi/csi-provisioner:v1.4.0"
diff --git a/cluster/examples/kubernetes/ceph/operator.yaml b/cluster/examples/kubernetes/ceph/operator.yaml
index 4e190a681..d2b521a81 100644
--- a/cluster/examples/kubernetes/ceph/operator.yaml
+++ b/cluster/examples/kubernetes/ceph/operator.yaml
@@ -46,7 +46,7 @@ data:
   # The default version of CSI supported by Rook will be started. To change the version
   # of the CSI driver to something other than what is officially supported, change
   # these images to the desired release of the CSI driver.
-  # ROOK_CSI_CEPH_IMAGE: "quay.io/cephcsi/cephcsi:v2.0.1"
+  # ROOK_CSI_CEPH_IMAGE: "quay.io/cephcsi/cephcsi:v2.1.0"
   # ROOK_CSI_REGISTRAR_IMAGE: "quay.io/k8scsi/csi-node-driver-registrar:v1.2.0"
   # ROOK_CSI_RESIZER_IMAGE: "quay.io/k8scsi/csi-resizer:v0.4.0"
   # ROOK_CSI_PROVISIONER_IMAGE: "quay.io/k8scsi/csi-provisioner:v1.4.0"
diff --git a/pkg/operator/ceph/csi/spec.go b/pkg/operator/ceph/csi/spec.go
index 036fb9710..914da0900 100644
--- a/pkg/operator/ceph/csi/spec.go
+++ b/pkg/operator/ceph/csi/spec.go
@@ -98,7 +98,7 @@ var (
 // manually challenging.
 var (
 	// image names
-	DefaultCSIPluginImage   = "quay.io/cephcsi/cephcsi:v2.0.1"
+	DefaultCSIPluginImage   = "quay.io/cephcsi/cephcsi:v2.1.0"
 	DefaultRegistrarImage   = "quay.io/k8scsi/csi-node-driver-registrar:v1.2.0"
 	DefaultProvisionerImage = "quay.io/k8scsi/csi-provisioner:v1.4.0"
 	DefaultAttacherImage    = "quay.io/k8scsi/csi-attacher:v2.1.0"
diff --git a/pkg/operator/ceph/csi/version.go b/pkg/operator/ceph/csi/version.go
index c58626745..610bb261e 100644
--- a/pkg/operator/ceph/csi/version.go
+++ b/pkg/operator/ceph/csi/version.go
@@ -29,7 +29,8 @@ var (
 	minimum = CephCSIVersion{2, 0, 0}
 
 	//supportedCSIVersions are versions that rook supports
-	supportedCSIVersions = []CephCSIVersion{minimum}
+	releaseV210          = CephCSIVersion{2, 1, 0}
+	supportedCSIVersions = []CephCSIVersion{minimum, releaseV210}
 
 	// for parsing the output of `cephcsi`
 	versionCSIPattern = regexp.MustCompile(`v(\d+)\.(\d+)\.(\d+)`)


Test patch:
diff --git a/pkg/operator/ceph/csi/version_test.go b/pkg/operator/ceph/csi/version_test.go
index c33b09ba4..4b46fa472 100644
--- a/pkg/operator/ceph/csi/version_test.go
+++ b/pkg/operator/ceph/csi/version_test.go
@@ -23,33 +23,57 @@ import (
 )
 
 var (
-	testVersion            = CephCSIVersion{2, 0, 0}
-	testVersionUnsupported = CephCSIVersion{2, 1, 0}
+	testMinVersion         = CephCSIVersion{2, 0, 0}
+	testReleaseV210        = CephCSIVersion{2, 1, 0}
+	testVersionUnsupported = CephCSIVersion{2, 2, 0}
 )
 
 func TestIsAtLeast(t *testing.T) {
 	// Test version which is smaller
 	var version = CephCSIVersion{1, 40, 10}
-	ret := testVersion.isAtLeast(&version)
+	ret := testMinVersion.isAtLeast(&version)
 	assert.Equal(t, true, ret)
 
 	// Test version which is equal
-	ret = testVersion.isAtLeast(&testVersion)
+	ret = testMinVersion.isAtLeast(&testMinVersion)
 	assert.Equal(t, true, ret)
 
 	// Test version which is greater (minor)
 	version = CephCSIVersion{2, 1, 0}
-	ret = testVersion.isAtLeast(&version)
+	ret = testMinVersion.isAtLeast(&version)
 	assert.Equal(t, false, ret)
 
+	// Test version which is greater (bugfix)
+	version = CephCSIVersion{2, 2, 0}
+	ret = testMinVersion.isAtLeast(&version)
+	assert.Equal(t, false, ret)
+
+	// Test for v2.1.0
 	// Test version which is greater (bugfix)
 	version = CephCSIVersion{2, 0, 1}
-	ret = testVersion.isAtLeast(&version)
+	ret = testReleaseV210.isAtLeast(&version)
+	assert.Equal(t, true, ret)
+
+	// Test version which is equal
+	ret = testReleaseV210.isAtLeast(&testReleaseV210)
+	assert.Equal(t, true, ret)
+
+	// Test version which is greater (minor)
+	version = CephCSIVersion{2, 1, 1}
+	ret = testReleaseV210.isAtLeast(&version)
+	assert.Equal(t, false, ret)
+
+	// Test version which is greater (bugfix)
+	version = CephCSIVersion{2, 2, 0}
+	ret = testMinVersion.isAtLeast(&version)
 	assert.Equal(t, false, ret)
 }
 
 func TestSupported(t *testing.T) {
-	ret := testVersion.Supported()
+	ret := testMinVersion.Supported()
+	assert.Equal(t, true, ret)
+
+	ret = testReleaseV210.Supported()
 	assert.Equal(t, true, ret)
 
 	ret = testVersionUnsupported.Supported()