Skip to content

Commit

Permalink
Fix pg_autoscaler won't scale due to overlapping roots
Browse files Browse the repository at this point in the history
There was no CephBlockPool defined for the .mgr pool, therefore it was
using the default crush rule (with no deviceClass specified).
Also the CephObjectStore & CephFilesystem metadataPool does not define
the deviceClass (it is only set in the dataPools).

To fix this Create a CephBlockPool CR for the .mgr pool with the
same poolSpec as the default CephBlockPool. Also set the deviceClass
for the metadataPool in CephObjectStore and CephFilesystem.

Signed-off-by: Malay Kumar Parida <[email protected]>
  • Loading branch information
malayparida2000 committed Jul 12, 2024
1 parent 2939ab0 commit bf8120c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
16 changes: 16 additions & 0 deletions controllers/storagecluster/cephblockpools.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ func (r *StorageClusterReconciler) addPeerSecretsToCephBlockPool(initData *ocsv1
func (r *StorageClusterReconciler) newCephBlockPoolInstances(initData *ocsv1.StorageCluster) ([]*cephv1.CephBlockPool, error) {
var mirroringSpec cephv1.MirroringSpec
poolName := generateNameForCephBlockPool(initData)
// This name is used by UI to hide this pool from the list of CephBlockPools
builtinMgrPoolName := "builtin-mgr"
poolNamespace := initData.Namespace

if initData.Spec.Mirroring.Enabled {
Expand All @@ -69,6 +71,20 @@ func (r *StorageClusterReconciler) newCephBlockPoolInstances(initData *ocsv1.Sto
},
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: builtinMgrPoolName,
Namespace: poolNamespace,
},
Spec: cephv1.NamedBlockPoolSpec{
Name: ".mgr",
PoolSpec: cephv1.PoolSpec{
DeviceClass: initData.Status.DefaultCephDeviceClass,
FailureDomain: getFailureDomain(initData),
Replicated: generateCephReplicatedSpec(initData, "metadata"),
},
},
},
}

// Create Non-Resilient CephBlockPools if enabled
Expand Down
6 changes: 3 additions & 3 deletions controllers/storagecluster/cephblockpools_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ func assertCephNFSBlockPool(t *testing.T, reconciler StorageClusterReconciler, c
expectedAf, err := reconciler.newCephBlockPoolInstances(cr)
assert.NoError(t, err)

assert.Equal(t, len(expectedAf[1].OwnerReferences), 1)
assert.Equal(t, len(expectedAf[2].OwnerReferences), 1)

assert.Equal(t, expectedAf[1].ObjectMeta.Name, actualNFSBlockPool.ObjectMeta.Name)
assert.Equal(t, expectedAf[1].Spec, actualNFSBlockPool.Spec)
assert.Equal(t, expectedAf[2].ObjectMeta.Name, actualNFSBlockPool.ObjectMeta.Name)
assert.Equal(t, expectedAf[2].Spec, actualNFSBlockPool.Spec)
}
3 changes: 3 additions & 0 deletions controllers/storagecluster/cephfilesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ func (r *StorageClusterReconciler) newCephFilesystemInstances(initStorageCluster
}
}

// set device class for metadata pool from the default data pool
ret.Spec.MetadataPool.DeviceClass = ret.Spec.DataPools[0].PoolSpec.DeviceClass

err := controllerutil.SetControllerReference(initStorageCluster, ret, r.Scheme)
if err != nil {
r.Log.Error(err, "Unable to set Controller Reference for CephFileSystem.", "CephFileSystem", klog.KRef(ret.Namespace, ret.Name))
Expand Down
1 change: 1 addition & 0 deletions controllers/storagecluster/cephobjectstores.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func (r *StorageClusterReconciler) newCephObjectStoreInstances(initData *ocsv1.S
Replicated: generateCephReplicatedSpec(initData, "data"),
},
MetadataPool: cephv1.PoolSpec{
DeviceClass: initData.Status.DefaultCephDeviceClass,
FailureDomain: initData.Status.FailureDomain,
Replicated: generateCephReplicatedSpec(initData, "metadata"),
},
Expand Down

0 comments on commit bf8120c

Please sign in to comment.