-
Notifications
You must be signed in to change notification settings - Fork 200
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
feat(spc): add feature to limit overprovisioning of cstor volumes #1577
feat(spc): add feature to limit overprovisioning of cstor volumes #1577
Conversation
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.
Found some fixes!
P.S. share your ideas, feedbacks or issues with us at https://github.com/fixmie/feedback (this message will be removed after the beta stage).
f5d5b75
to
97a8412
Compare
97a8412
to
72474d1
Compare
Signed-off-by: Ashutosh Kumar <ashutosh.kumar@openebs.io>
72474d1
to
2880fd8
Compare
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.
/lgtm
Signed-off-by: Ashutosh Kumar <ashutosh.kumar@mayadata.io>
Signed-off-by: Ashutosh Kumar <ashutosh.kumar@mayadata.io>
Signed-off-by: Ashutosh Kumar <ashutosh.kumar@mayadata.io>
Signed-off-by: Ashutosh Kumar <ashutosh.kumar@mayadata.io>
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.
changes are good
var totalcapcity resource.Quantity | ||
cstorVolumeMap := make(map[string]bool) | ||
label := string(apis.CStorPoolKey) + "=" + csp.Name | ||
cstorVolumeReplicaObjList, err := cstorvolumereplica.NewKubeclient().WithNamespace(p.openebsNamespace).List(metav1.ListOptions{LabelSelector: label}) |
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.
does CVRs always stay in openebsNamespace?
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.
openebsNamespace
is the namespace where openebs is installed. And CVRs always stay in a namespace where openebs is installed.
|
||
// getCStorVolumeCapacity returns the capacity present on a CStorVolume CR. | ||
func (p *scheduleWithOverProvisioningAwareness) getCStorVolumeCapacity(name string) (resource.Quantity, error) { | ||
cv, err := cstorvolume.NewKubeclient().WithNamespace(p.openebsNamespace).Get(name, metav1.GetOptions{}) |
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.
does cv stays in openebsNamespace?
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.
Same as above
Signed-off-by: Ashutosh Kumar <ashutosh.kumar@mayadata.io>
func getVolumeCapacity(values ...string) (resource.Quantity, error) { | ||
var capacity string | ||
for _, val := range values { | ||
if strings.Contains(val, string(volumeCapacityLabel)) { |
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.
where are we filling this label with total capacity?
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.
ok.. got it.. this is the capacity of the volume to be provisioned
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.
changes are good
This PR adds a feature to limit the over-provisioning of a CStor volume on SPC pools and hence fixes the issue openebs/openebs#2855 for cStor volume provisioned on SPC.
A similar feature for CSPC would be introduced in upcoming PRs.
Refer to following doc for solution approach:
https://docs.google.com/document/d/1JFsrZsOiV9GLG4IJ6mDrbNf5flvS1BKExCzI8J3hX2I/edit
Example :
All the pools created under above SPC YAML will obey the over provisioning policy ( i.e. disabled).
Consider an example, if a CStor volume is created with 7G of capacity with
n
replicas thenn
pools should be available with availableSpaceOnPool>incomingVolumeCapacity(7G in this case) according to below formula:availableSpaceOnPool:= (PoolCapacity*threshold/100 - Sum of all existing Volumes Capacities on the pool)
(Here
threshold
is by default 70% and can be overridden with OpenEBS annotations. A separate PR needs to be raised for this threshold overriding ability.)If
n
such pools are not found -- the provisioning will fail.One more point to note is that, if overprovisioning is disabled on SPC then all the pools(CSP) of that SPC will have overprovisioning disabled. There is no such case where one pool of SPC will have overprovisioning disabled and another one enabled.
In short, the overprovisioning policy specified on SPC applies homogenously to all the CSPs(pools) of the SPC.
Signed-off-by: Ashutosh Kumar ashutosh.kumar@openebs.io
Special notes for your reviewer:
Needs an e2e verification of the current feature.
Needs an e2e verification to check for regression(if any) of other existing policies of CVR placement.