Skip to content

Commit

Permalink
Merge pull request #2694 from malayparida2000/metadata_pool
Browse files Browse the repository at this point in the history
Fix pg_autoscaler won't scale due to overlapping roots
  • Loading branch information
openshift-merge-bot[bot] authored Jul 15, 2024
2 parents d8d1f6f + bf8120c commit 01bfbf8
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 01bfbf8

Please sign in to comment.