-
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(PDB, cStor Pools): add a support to create PDB for cStor #1573
feat(PDB, cStor Pools): add a support to create PDB for cStor #1573
Conversation
44644a1
to
29acf37
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. Just added a few nit comments.
// 3. If PDB doesn't exist it creates new PDB(With CSPC hash) | ||
func getOrCreatePodDisruptionBudget( | ||
cvObj *apis.CStorVolume, cspcName string) (*policy.PodDisruptionBudget, error) { | ||
poolNames, err := cvr.GetReplicaPoolNames(cvObj) |
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.
cvr.GetReplicaPoolNames(cvobj) doesn't makes sense and can lead to circular dependency.. make it as cvobj.GetReplicaPoolNames()
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.
It will not lead to circular dependency but passing cvObj in CVR package doesn't make sense I will update it.
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.
updated it as cvr.GetVolumeReplicaPoolNames(pvName, namespace)
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.
we need to remove Gopkg.lock file?
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.
fix the sample PDB yaml in the PR description
return nil, errors.Wrapf(err, | ||
"failed to list PDB belongs to pools %v", pdbLabels) | ||
} | ||
if len(pdbList.Items) > 1 { |
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 this work even if multiple CVC controllers are running at same time?
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.
Looks like we have to take a lease on PDB also when we take on CVC.
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.
It will work without any changes
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.
is this PR takes care of multiple CVC controllers as well?
@@ -263,6 +275,16 @@ func (c *CVCController) createVolumeOperation(cvc *apis.CStorVolumeClaim) (*apis | |||
return nil, err | |||
} | |||
|
|||
if cvclaim.IsHAVolume(cvc) { |
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.
this being small function and doesn't depend on package related things, cvc.IsHAVolume() looks to be good
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.
To define cvc.IsHAVolume() we have to define in apis package i.e pkg/apis/openebs.io/v1alpha1
which is not good practice. So I will define in same cmd/cvc-operator/controller/cvc_controller.go
file
cvcLabelSelector := string(apis.PodDisruptionBudgetKey) + "=" + pdbName | ||
cvcList, err := c.clientset. | ||
OpenebsV1alpha1(). | ||
CStorVolumeClaims(cvc.Namespace). |
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.
can there be CVCs in different namespace using same PDB?
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.
No!! With current design all the OpenEBS related resources will be in one namespace where OpenEBS installed.
} | ||
// Create podDisruptionBudget | ||
return apispdb.KubeClient(). | ||
WithNamespace(cvObj.Namespace). |
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.
we are creating in cvObj, but, listing in getNamespace().. can they be different?
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.
Always both will be the same but to maintain consistency I will update to it to getNamesapce()...
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.
testcases are required
#1574 This PR will cover one test case a few others will be rolled out one this is merged. |
Why do we need to remove it? |
|
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
29acf37
to
985bad4
Compare
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@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
Signed-off-by: mittachaitu sai.chaithanya@mayadata.io
What this PR does:
This PR adds support to create PodDisruptionBudget only for cStor Pool pods
which contains HA volume replicas(volume provisioned with >= 3 replicas) in cStor pools.
why we need it:
Valid voluntary disruptions will be disallowed on cStor pool pods if eviction of cStor pool pod affects the volume quorum factor.
Example for PDB creation:
Provisioned a CSPC with five pool specs that intern creates 5 cStor pools. Now hundreds of HA volumes are provisioned with 3 replicas and volume replicas can be scheduled in any random order across CSPC cStor pools, no.of PDBs’ will be combination among the cStor pools. In this case, at most 5C3 PDBs will be created i.e 10 PDBs will be created[what if my storage replica count is 4? 5C3 + 5C4 PDB will be created].
Sample PDB YAML:
Sample CVC yaml after refering to PDB:
In above CVC
openebs.io/pod-disruption-budget: cstor-sparse-cspcq65jf
label is added.
Design Doc:
https://docs.google.com/document/d/1Pq2ZDE7K1ttmqdJl4LgZW1B6JImxzJsLGrydOpjV7rs/edit?usp=sharing
OEP for PDB:
openebs/openebs#2887
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
Checklist:
documentation
tagbreaking-changes
tagrequires-upgrade
tag