-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable specifying target size ratio for block, file and object pools #2979
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -136,19 +136,40 @@ func generateNameForCephRbdMirror(initData *ocsv1.StorageCluster) string { | |||||
|
||||||
// generateCephReplicatedSpec returns the ReplicatedSpec for the cephCluster | ||||||
// based on the StorageCluster configuration | ||||||
func generateCephReplicatedSpec(initData *ocsv1.StorageCluster, poolType string) cephv1.ReplicatedSpec { | ||||||
func generateCephReplicatedSpec(initData *ocsv1.StorageCluster, poolType string, storageType string) cephv1.ReplicatedSpec { | ||||||
crs := cephv1.ReplicatedSpec{} | ||||||
|
||||||
crs.Size = getCephPoolReplicatedSize(initData) | ||||||
crs.ReplicasPerFailureDomain = uint(getReplicasPerFailureDomain(initData)) | ||||||
//lint:ignore ST1017 required to compare it directly | ||||||
if "data" == poolType { | ||||||
crs.TargetSizeRatio = .49 | ||||||
if poolType == poolTypeData { | ||||||
crs.TargetSizeRatio = getTargetSizeRatio(initData, storageType) | ||||||
} | ||||||
|
||||||
return crs | ||||||
} | ||||||
|
||||||
func getTargetSizeRatio(initData *ocsv1.StorageCluster, storageType string) float64 { | ||||||
defaultTargetSizeRatio := 0.49 | ||||||
var definedRatio float64 | ||||||
|
||||||
switch storageType { | ||||||
case storageTypeBlock: | ||||||
definedRatio = initData.Spec.ManagedResources.CephBlockPools.PoolSpec.Replicated.TargetSizeRatio | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, the PoolSpec.TargetSizeRatio was deprecated in rook a long time ago, but we have kept it for backward compatibility. Instead, let's use the parameters:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ack, @travisn Even though the field was deprecated there doesn't seem to any comment/kubebuilder warning in rook suggesting that. I think that can be added in rook APIs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @travisn Another question if both Replicated.TargetSizeRatio & Parameters["target_size_ratio"] are specified then which one has higher priority? |
||||||
case storageTypeFile: | ||||||
definedRatio = initData.Spec.ManagedResources.CephFilesystems.DataPoolSpec.Replicated.TargetSizeRatio | ||||||
case storageTypeObject: | ||||||
definedRatio = initData.Spec.ManagedResources.CephObjectStores.DataPoolSpec.Replicated.TargetSizeRatio | ||||||
default: | ||||||
return defaultTargetSizeRatio // Return default for unexpected storageType | ||||||
} | ||||||
|
||||||
if definedRatio == 0.0 { | ||||||
return defaultTargetSizeRatio // Apply default if not set | ||||||
} | ||||||
|
||||||
return definedRatio | ||||||
} | ||||||
|
||||||
// generateStorageQuotaName function generates a name for ClusterResourceQuota | ||||||
func generateStorageQuotaName(storageClassName, quotaName string) string { | ||||||
return fmt.Sprintf("%s-%s", storageClassName, quotaName) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont we need a separate one here for nfs as it was earlier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have asked Travis on what we need to do for nfs here
#2979 (comment)