Skip to content
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

Refactor vrg-kubeobject functions #1712

Conversation

raghavendra-talur
Copy link
Member

@raghavendra-talur raghavendra-talur commented Dec 10, 2024

Refactored the following functions

  • kubeObjectsRecoveryStartOrResume
  • executeRecoverGroup
  • kubeObjectsRecover

@raghavendra-talur raghavendra-talur changed the title vrg: refactor executeRecoverGroup function parameters Refactor kubeObjectsRecoveryStartOrResume and executeRecoverGroup functions Dec 10, 2024
@raghavendra-talur raghavendra-talur changed the title Refactor kubeObjectsRecoveryStartOrResume and executeRecoverGroup functions Refactor vrg-kubeobject functions Dec 10, 2024
@raghavendra-talur raghavendra-talur force-pushed the rtalur-simplify-ExecuteRecoverGroup branch from 71e670d to ffce5e1 Compare December 10, 2024 06:54
Copy link
Member

@asn1809 asn1809 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@raghavendra-talur raghavendra-talur force-pushed the rtalur-simplify-ExecuteRecoverGroup branch from 8c8c4d0 to 395bd2a Compare December 11, 2024 21:32
@raghavendra-talur
Copy link
Member Author

@BenamarMk This PR is ready for review. I have rebased it on top of #1709 so the e2e failures should be gone.

if v.kubeObjectProtectionDisabled("recovery") {
return nil
}
func (v *VRGInstance) getVRGFromS3Profile(s3ProfileName string) (*ramen.VolumeReplicationGroup, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this function: GetLastKnownVRGPrimaryFromS3. Can we have a common function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BenamarMk that is a function in DRPC and this is a function in VRG as a method on VRGInstance, can I take up the refactoring in a later PR?

raghavendra-talur and others added 7 commits December 16, 2024 12:52
- created methods for getting capture and recover requests
- removed function parameters that can be obtained using v.instance.

Co-Authored-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Raghavendra Talur <[email protected]>
- Remove `sourceVrgNamespaceName` and `sourceVrgName` as parameters.
- Derive `sourceVrgNamespaceName` and `sourceVrgName` directly from the instance.

Co-Authored-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Raghavendra Talur <[email protected]>
- Removed unnecessary local variable `localS3StoreAccessor`

Co-Authored-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Raghavendra Talur <[email protected]>
- `getVRGFromS3Profile` gets the source vrg
- call `getVRGFromS3Profile` from `kubeObjectsRecover`

Co-Authored-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Raghavendra Talur <[email protected]>
Co-Authored-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Raghavendra Talur <[email protected]>
Co-Authored-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Raghavendra Talur <[email protected]>
…ore retrival

- Updated the `findS3StoreAccessor` method to accept `s3ProfileName` directly
- Removed unnecessary intermediate variable `localS3StoreAccessor`

Co-Authored-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Raghavendra Talur <[email protected]>
@raghavendra-talur raghavendra-talur force-pushed the rtalur-simplify-ExecuteRecoverGroup branch from 395bd2a to 5d5170d Compare December 16, 2024 18:06
We were passing veleroNamespaceName through many functions where it can
be obtained from the v object. Don't pass it as a parameter until the
last call.

Functions:
- `getRecoverOrProtectRequest`
- `kubeObjectsRecoveryStartOrResume`
- `executeRecoverGroup` by removing the `veleroNamespaceName` parameter.

Co-Authored-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Raghavendra Talur <[email protected]>
@raghavendra-talur raghavendra-talur force-pushed the rtalur-simplify-ExecuteRecoverGroup branch from 5d5170d to c1cb4e1 Compare December 16, 2024 18:20
Co-Authored-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Raghavendra Talur <[email protected]>
@raghavendra-talur raghavendra-talur force-pushed the rtalur-simplify-ExecuteRecoverGroup branch from d5e747a to f9d4955 Compare December 17, 2024 07:02
Copy link
Member

@ELENAGER ELENAGER left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the changes! Code is much better now.

@ShyamsundarR ShyamsundarR merged commit 4df09e7 into RamenDR:main Dec 19, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants