Skip to content

Commit

Permalink
ceph: lift minimum supported version of ceph csi to v3.3.0
Browse files Browse the repository at this point in the history
With the release of Ceph CSI 3.4.0, Ceph CSI project came up
with a new support policy where we support only versions >= 3.3.0

The supported window of Ceph CSI versions is known as "N.(x-1)":
 (N (Latest major release) . (x (Latest minor release) - 1)).

For example, if Ceph CSI latest major version is 3.4.0 today,
support is provided for the versions above 3.3.0.
If users are running an unsupported Ceph CSI version, they will be
asked to upgrade when requesting support for the cluster.

This PR lift the minimum supported version of Ceph CSI to 3.3.0
in this repo.

Fix #8709

Ref #
https://github.com/ceph/ceph-csi/releases/tag/v3.4.0
https://github.com/ceph/ceph-csi/#known-to-work-co-platforms

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
(cherry picked from commit 731b0f5)
  • Loading branch information
humblec committed Sep 23, 2021
1 parent 97a084a commit 92524cb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 116 deletions.
4 changes: 4 additions & 0 deletions Documentation/ceph-csi-drivers.md
Expand Up @@ -19,6 +19,10 @@ For documentation on consuming the storage:
* RBD: See the [Block Storage](ceph-block.md) topic
* CephFS: See the [Shared Filesystem](ceph-filesystem.md) topic

## Supported Versions
The supported Ceph CSI version is 3.3.0 or greater with Rook. Refer to ceph csi [releases](https://github.com/ceph/ceph-csi/releases)
for more information.

## Static Provisioning

Both drivers also support the creation of static PV and static PVC from existing RBD image/CephFS volume. Refer to [static PVC](https://github.com/ceph/ceph-csi/blob/devel/docs/static-pvc.md) for more information.
Expand Down
9 changes: 1 addition & 8 deletions pkg/operator/ceph/csi/spec.go
Expand Up @@ -312,14 +312,7 @@ func startDrivers(clientset kubernetes.Interface, rookclientset rookclient.Inter
if err != nil {
return errors.Wrap(err, "failed to load CSI_PROVISIONER_PRIORITY_CLASSNAME setting")
}

// OMAP generator will be enabled by default
// If AllowUnsupported is set to false and if CSI version is less than
// <3.2.0 disable OMAP generator sidecar
if !v.SupportsOMAPController() {
tp.EnableOMAPGenerator = false
}


enableOMAPGenerator, err := k8sutil.GetOperatorSetting(clientset, controllerutil.OperatorSettingConfigMapName, "CSI_ENABLE_OMAP_GENERATOR", "false")
if err != nil {
return errors.Wrap(err, "failed to load CSI_ENABLE_OMAP_GENERATOR setting")
Expand Down
37 changes: 2 additions & 35 deletions pkg/operator/ceph/csi/version.go
Expand Up @@ -25,22 +25,16 @@ import (
)

var (
//minimum supported version is 3.0.0
minimum = CephCSIVersion{3, 0, 0}
//minimum supported version is 3.3.0
minimum = CephCSIVersion{3, 3, 0}
//supportedCSIVersions are versions that rook supports
releasev310 = CephCSIVersion{3, 1, 0}
releasev320 = CephCSIVersion{3, 2, 0}
releasev330 = CephCSIVersion{3, 3, 0}
releasev340 = CephCSIVersion{3, 4, 0}
supportedCSIVersions = []CephCSIVersion{
minimum,
releasev310,
releasev320,
releasev330,
releasev340,
}
// omap generator is supported in v3.2.0+
omapSupportedVersions = releasev320
// for parsing the output of `cephcsi`
versionCSIPattern = regexp.MustCompile(`v(\d+)\.(\d+)\.(\d+)`)
)
Expand All @@ -57,33 +51,6 @@ func (v *CephCSIVersion) String() string {
v.Major, v.Minor, v.Bugfix)
}

// SupportsOMAPController checks if the detected version supports OMAP generator
func (v *CephCSIVersion) SupportsOMAPController() bool {

// if AllowUnsupported is set also a csi-image greater than the supported ones are allowed
if AllowUnsupported {
return true
}

if !v.isAtLeast(&minimum) {
return false
}

if v.Major > omapSupportedVersions.Major {
return true
}
if v.Major == omapSupportedVersions.Major {
if v.Minor > omapSupportedVersions.Minor {
return true
}
if v.Minor == omapSupportedVersions.Minor {
return v.Bugfix >= omapSupportedVersions.Bugfix
}
}

return false
}

// Supported checks if the detected version is part of the known supported CSI versions
func (v *CephCSIVersion) Supported() bool {
if !v.isAtLeast(&minimum) {
Expand Down
79 changes: 6 additions & 73 deletions pkg/operator/ceph/csi/version_test.go
Expand Up @@ -23,11 +23,7 @@ import (
)

var (
testMinVersion = CephCSIVersion{2, 0, 0}
testReleaseV210 = CephCSIVersion{2, 1, 0}
testReleaseV300 = CephCSIVersion{3, 0, 0}
testReleaseV320 = CephCSIVersion{3, 2, 0}
testReleaseV321 = CephCSIVersion{3, 2, 1}
testMinVersion = CephCSIVersion{3, 3, 0}
testReleaseV330 = CephCSIVersion{3, 3, 0}
testReleaseV340 = CephCSIVersion{3, 4, 0}
testVersionUnsupported = CephCSIVersion{4, 0, 0}
Expand All @@ -43,95 +39,32 @@ func TestIsAtLeast(t *testing.T) {
ret = testMinVersion.isAtLeast(&testMinVersion)
assert.Equal(t, true, ret)

// Test version which is greater (minor)
version = CephCSIVersion{2, 1, 0}
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 = 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 = testReleaseV210.isAtLeast(&version)
assert.Equal(t, false, ret)

// Test for 3.0.0
// Test version which is equal
ret = testReleaseV300.isAtLeast(&testReleaseV300)
assert.Equal(t, true, ret)

// Test for 3.3.0
// Test version which is lesser
ret = testReleaseV330.isAtLeast(&testReleaseV300)
ret = testReleaseV330.isAtLeast(&testReleaseV330)
assert.Equal(t, true, ret)

// Test for 3.4.0
// Test version which is lesser
ret = testReleaseV340.isAtLeast(&testReleaseV330)
assert.Equal(t, true, ret)

// Test version which is greater (minor)
version = CephCSIVersion{3, 1, 1}
ret = testReleaseV300.isAtLeast(&version)
assert.Equal(t, false, ret)

// Test version which is greater (bugfix)
version = CephCSIVersion{3, 2, 0}
ret = testReleaseV300.isAtLeast(&version)
assert.Equal(t, false, ret)
}

func TestSupported(t *testing.T) {
AllowUnsupported = false
ret := testMinVersion.Supported()
assert.Equal(t, false, ret)
assert.Equal(t, true, ret)

ret = testVersionUnsupported.Supported()
assert.Equal(t, false, ret)

ret = testReleaseV330.Supported()
assert.Equal(t, true, ret)

ret = testReleaseV340.Supported()
assert.Equal(t, true, ret)
}

func TestSupportOMAPController(t *testing.T) {
AllowUnsupported = true
ret := testMinVersion.SupportsOMAPController()
assert.True(t, ret)

AllowUnsupported = false
ret = testMinVersion.SupportsOMAPController()
assert.False(t, ret)

ret = testReleaseV300.SupportsOMAPController()
assert.False(t, ret)

ret = testReleaseV320.SupportsOMAPController()
assert.True(t, ret)

ret = testReleaseV321.SupportsOMAPController()
assert.True(t, ret)

ret = testReleaseV330.SupportsOMAPController()
assert.True(t, ret)
}
func Test_extractCephCSIVersion(t *testing.T) {
expectedVersion := CephCSIVersion{3, 0, 0}
csiString := []byte(`Cephcsi Version: v3.0.0
Expand Down

0 comments on commit 92524cb

Please sign in to comment.