diff --git a/Documentation/CRDs/Block-Storage/ceph-block-pool-crd.md b/Documentation/CRDs/Block-Storage/ceph-block-pool-crd.md
index ff7dabb1e..472508013 100644
--- a/Documentation/CRDs/Block-Storage/ceph-block-pool-crd.md
+++ b/Documentation/CRDs/Block-Storage/ceph-block-pool-crd.md
@@ -200,6 +200,7 @@ stretched) then you will have 2 replicas per datacenter where each replica ends
Neither Rook, nor Ceph, prevent the creation of a cluster where the replicated data (or Erasure Coded chunks) can be written safely. By design, Ceph will delay checking for suitable OSDs until a write request is made and this write can hang if there are not sufficient OSDs to satisfy the request.
* `deviceClass`: Sets up the CRUSH rule for the pool to distribute data only on the specified device class. If left empty or unspecified, the pool will use the cluster's default CRUSH root, which usually distributes data over all OSDs, regardless of their class. If `deviceClass` is specified on any pool, ensure that it is added to every pool in the cluster, otherwise Ceph will warn about pools with overlapping roots.
* `crushRoot`: The root in the crush map to be used by the pool. If left empty or unspecified, the default root will be used. Creating a crush hierarchy for the OSDs currently requires the Rook toolbox to run the Ceph tools described [here](http://docs.ceph.com/docs/master/rados/operations/crush-map/#modifying-the-crush-map).
+* `enableCrushUpdates`: Enables rook to update the pool crush rule using Pool Spec. Can cause data remapping if crush rule changes, Defaults to false.
* `enableRBDStats`: Enables collecting RBD per-image IO statistics by enabling dynamic OSD performance counters. Defaults to false. For more info see the [ceph documentation](https://docs.ceph.com/docs/master/mgr/prometheus/#rbd-io-statistics).
* `name`: The name of Ceph pools is based on the `metadata.name` of the CephBlockPool CR. Some built-in Ceph pools
require names that are incompatible with K8s resource names. These special pools can be configured
diff --git a/Documentation/CRDs/Cluster/ceph-cluster-crd.md b/Documentation/CRDs/Cluster/ceph-cluster-crd.md
index 168dcb141..aba50fd31 100755
--- a/Documentation/CRDs/Cluster/ceph-cluster-crd.md
+++ b/Documentation/CRDs/Cluster/ceph-cluster-crd.md
@@ -346,6 +346,7 @@ The following storage selection settings are specific to Ceph and do not apply t
* `osdsPerDevice`**: The number of OSDs to create on each device. High performance devices such as NVMe can handle running multiple OSDs. If desired, this can be overridden for each node and each device.
* `encryptedDevice`**: Encrypt OSD volumes using dmcrypt ("true" or "false"). By default this option is disabled. See [encryption](http://docs.ceph.com/docs/master/ceph-volume/lvm/encryption/) for more information on encryption in Ceph. (Resizing is not supported for host-based clusters.)
* `crushRoot`: The value of the `root` CRUSH map label. The default is `default`. Generally, you should not need to change this. However, if any of your topology labels may have the value `default`, you need to change `crushRoot` to avoid conflicts, since CRUSH map values need to be unique.
+* `enableCrushUpdates`: Enables rook to update the pool crush rule using Pool Spec. Can cause data remapping if crush rule changes, Defaults to false.
Allowed configurations are:
diff --git a/Documentation/CRDs/specification.md b/Documentation/CRDs/specification.md
index f03bc8648..a16592e14 100644
--- a/Documentation/CRDs/specification.md
+++ b/Documentation/CRDs/specification.md
@@ -10478,6 +10478,18 @@ string
+
compressionMode
string
diff --git a/deploy/charts/rook-ceph/templates/resources.yaml b/deploy/charts/rook-ceph/templates/resources.yaml
index bac4fb8a1..da00db828 100644
--- a/deploy/charts/rook-ceph/templates/resources.yaml
+++ b/deploy/charts/rook-ceph/templates/resources.yaml
@@ -184,6 +184,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -6540,6 +6543,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -6721,6 +6727,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -10198,6 +10207,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -11310,6 +11322,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -12037,6 +12052,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -12213,6 +12231,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
diff --git a/deploy/examples/crds.yaml b/deploy/examples/crds.yaml
index 0a510790c..fe48be2f6 100644
--- a/deploy/examples/crds.yaml
+++ b/deploy/examples/crds.yaml
@@ -186,6 +186,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -6535,6 +6538,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -6716,6 +6722,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -10189,6 +10198,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -11301,6 +11313,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -12025,6 +12040,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
@@ -12201,6 +12219,9 @@ spec:
description: The device class the OSD should set to for use in the pool
nullable: true
type: string
+ enableCrushUpdates:
+ description: Allow rook operator to change the pool CRUSH tunables once the pool is created
+ type: boolean
enableRBDStats:
description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
type: boolean
diff --git a/deploy/examples/pool.yaml b/deploy/examples/pool.yaml
index aa1668ae2..96117cae0 100644
--- a/deploy/examples/pool.yaml
+++ b/deploy/examples/pool.yaml
@@ -33,6 +33,8 @@ spec:
# If device classes are specified, ensure this property is added to every pool in the cluster,
# otherwise Ceph will warn about pools with overlapping roots.
#deviceClass: my-class
+ # allow rook to update pool spec and crush rule, use with caution, disabled by default
+ #enableCrushUpdates: true
# Enables collecting RBD per-image IO statistics by enabling dynamic OSD performance counters. Defaults to false.
# For reference: https://docs.ceph.com/docs/master/mgr/prometheus/#rbd-io-statistics
# enableRBDStats: true
diff --git a/pkg/apis/ceph.rook.io/v1/types.go b/pkg/apis/ceph.rook.io/v1/types.go
index f305f9553..d55ae3ccf 100755
--- a/pkg/apis/ceph.rook.io/v1/types.go
+++ b/pkg/apis/ceph.rook.io/v1/types.go
@@ -755,6 +755,10 @@ type PoolSpec struct {
// +nullable
DeviceClass string `json:"deviceClass,omitempty"`
+ // Allow rook operator to change the pool CRUSH tunables once the pool is created
+ // +optional
+ EnableCrushUpdates bool `json:"enableCrushUpdates,omitempty"`
+
// DEPRECATED: use Parameters instead, e.g., Parameters["compression_mode"] = "force"
// The inline compression mode in Bluestore OSD to set to (options are: none, passive, aggressive, force)
// +kubebuilder:validation:Enum=none;passive;aggressive;force;""
diff --git a/pkg/daemon/ceph/client/pool.go b/pkg/daemon/ceph/client/pool.go
index 7d26c3239..4677007fd 100644
--- a/pkg/daemon/ceph/client/pool.go
+++ b/pkg/daemon/ceph/client/pool.go
@@ -463,6 +463,12 @@ func createReplicatedPoolForApp(context *clusterd.Context, clusterInfo *ClusterI
}
func updatePoolCrushRule(context *clusterd.Context, clusterInfo *ClusterInfo, clusterSpec *cephv1.ClusterSpec, pool cephv1.NamedPoolSpec) error {
+
+ if !pool.EnableCrushUpdates {
+ logger.Debugf("Skipping crush rule update for pool %q: EnableCrushUpdates is disabled", pool.Name)
+ return nil
+ }
+
if pool.FailureDomain == "" && pool.DeviceClass == "" {
logger.Debugf("skipping check for failure domain and deviceClass on pool %q as it is not specified", pool.Name)
return nil
diff --git a/pkg/daemon/ceph/client/pool_test.go b/pkg/daemon/ceph/client/pool_test.go
index 929e8b832..db29c2686 100644
--- a/pkg/daemon/ceph/client/pool_test.go
+++ b/pkg/daemon/ceph/client/pool_test.go
@@ -281,7 +281,8 @@ func TestUpdateFailureDomain(t *testing.T) {
p := cephv1.NamedPoolSpec{
Name: "mypool",
PoolSpec: cephv1.PoolSpec{
- Replicated: cephv1.ReplicatedSpec{Size: 3},
+ Replicated: cephv1.ReplicatedSpec{Size: 3},
+ EnableCrushUpdates: true,
},
}
clusterSpec := &cephv1.ClusterSpec{Storage: cephv1.StorageScopeSpec{}}
@@ -294,8 +295,9 @@ func TestUpdateFailureDomain(t *testing.T) {
p := cephv1.NamedPoolSpec{
Name: "mypool",
PoolSpec: cephv1.PoolSpec{
- FailureDomain: currentFailureDomain,
- Replicated: cephv1.ReplicatedSpec{Size: 3},
+ FailureDomain: currentFailureDomain,
+ Replicated: cephv1.ReplicatedSpec{Size: 3},
+ EnableCrushUpdates: true,
},
}
testCrushRuleName = "mypool_rack"
@@ -305,12 +307,27 @@ func TestUpdateFailureDomain(t *testing.T) {
assert.Equal(t, "", newCrushRule)
})
+ t.Run("trying to change failure domain without enabling EnableCrushUpdates", func(t *testing.T) {
+ p := cephv1.NamedPoolSpec{
+ Name: "mypool",
+ PoolSpec: cephv1.PoolSpec{
+ FailureDomain: "zone",
+ Replicated: cephv1.ReplicatedSpec{Size: 3},
+ },
+ }
+ clusterSpec := &cephv1.ClusterSpec{Storage: cephv1.StorageScopeSpec{}}
+ err := updatePoolCrushRule(context, AdminTestClusterInfo("mycluster"), clusterSpec, p)
+ assert.NoError(t, err)
+ assert.Equal(t, "", newCrushRule)
+ })
+
t.Run("changing failure domain", func(t *testing.T) {
p := cephv1.NamedPoolSpec{
Name: "mypool",
PoolSpec: cephv1.PoolSpec{
- FailureDomain: "zone",
- Replicated: cephv1.ReplicatedSpec{Size: 3},
+ FailureDomain: "zone",
+ Replicated: cephv1.ReplicatedSpec{Size: 3},
+ EnableCrushUpdates: true,
},
}
clusterSpec := &cephv1.ClusterSpec{Storage: cephv1.StorageScopeSpec{}}
|