Merge pull request #14322 from ideepika/wip-disablecrush-updates

enableCrushUpdates option: rook operator would not be able to update crush rules by default if not set
This commit is contained in:
Blaine Gardner authored and GitHub committed 2024-06-17 12:20:26 -06:00
commit 4b51c2c3bd
9 files changed
+90 -5

No files matched your search

@@ -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
@@ -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:
+12
View File
@@ -10478,6 +10478,18 @@ string
</tr>
<tr>
<td>
<code>enableCrushUpdates</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Allow rook operator to change the pool CRUSH tunables once the pool is created</p>
</td>
</tr>
<tr>
<td>
<code>compressionMode</code><br/>
<em>
string
@@ -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
+21
View File
@@ -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
+2
View File
@@ -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
+4
View File
@@ -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;""
+6
View File
@@ -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
+22 -5
View File
@@ -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{}}