Skip to content

Commit

Permalink
vrg: refactor kubeObjectsRecover function to use s3ProfileName directly
Browse files Browse the repository at this point in the history
Co-Authored-by: Annaraya Narasagond <[email protected]>
Signed-off-by: Raghavendra Talur <[email protected]>
  • Loading branch information
raghavendra-talur and asn1809 committed Dec 12, 2024
1 parent 2955343 commit 04b8b2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions internal/controller/vrg_kubeobjects.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,12 +513,12 @@ func (v *VRGInstance) getVRGFromS3Profile(s3ProfileName string) (*ramen.VolumeRe
return vrg, nil
}

func (v *VRGInstance) kubeObjectsRecover(result *ctrl.Result, s3StoreProfile ramen.S3StoreProfile) error {
func (v *VRGInstance) kubeObjectsRecover(result *ctrl.Result, s3ProfileName string) error {
if v.kubeObjectProtectionDisabled("recovery") {
return nil
}

sourceVrg, err := v.getVRGFromS3Profile(s3StoreProfile.S3ProfileName)
sourceVrg, err := v.getVRGFromS3Profile(s3ProfileName)
if err != nil {
return fmt.Errorf("kube objects source VRG get error: %v", err)
}
Expand All @@ -529,9 +529,9 @@ func (v *VRGInstance) kubeObjectsRecover(result *ctrl.Result, s3StoreProfile ram
}

v.instance.Status.KubeObjectProtection.CaptureToRecoverFrom = captureToRecoverFromIdentifier
log := v.log.WithValues("number", captureToRecoverFromIdentifier.Number, "profile", s3StoreProfile.S3ProfileName)
log := v.log.WithValues("number", captureToRecoverFromIdentifier.Number, "profile", s3ProfileName)

return v.kubeObjectsRecoveryStartOrResume(result, s3StoreProfile.S3ProfileName, captureToRecoverFromIdentifier, log)
return v.kubeObjectsRecoveryStartOrResume(result, s3ProfileName, captureToRecoverFromIdentifier, log)
}

func (v *VRGInstance) findS3StoreAccessor(s3StoreProfile ramen.S3StoreProfile) (s3StoreAccessor, error) {
Expand Down
6 changes: 2 additions & 4 deletions internal/controller/vrg_volrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -2010,9 +2010,7 @@ func (v *VRGInstance) restorePVsAndPVCsFromS3(result *ctrl.Result) (int, error)

var objectStore ObjectStorer

var s3StoreProfile ramendrv1alpha1.S3StoreProfile

objectStore, s3StoreProfile, err = v.reconciler.ObjStoreGetter.ObjectStore(
objectStore, _, err = v.reconciler.ObjStoreGetter.ObjectStore(
v.ctx, v.reconciler.APIReader, s3ProfileName, v.namespacedName, v.log)
if err != nil {
v.log.Error(err, "Kube objects recovery object store inaccessible", "profile", s3ProfileName)
Expand Down Expand Up @@ -2046,7 +2044,7 @@ func (v *VRGInstance) restorePVsAndPVCsFromS3(result *ctrl.Result) (int, error)

v.log.Info(fmt.Sprintf("Restored %d PVs and %d PVCs using profile %s", pvCount, pvcCount, s3ProfileName))

return pvCount + pvcCount, v.kubeObjectsRecover(result, s3StoreProfile)
return pvCount + pvcCount, v.kubeObjectsRecover(result, s3ProfileName)
}

if NoS3 {
Expand Down

0 comments on commit 04b8b2e

Please sign in to comment.