Skip to content

Commit

Permalink
vrg: remove veleroNamespaceName parameter from a few functions
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
raghavendra-talur and asn1809 committed Dec 16, 2024
1 parent 3ba90c1 commit 5d5170d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions internal/controller/vrg_kubeobjects.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ func (v *VRGInstance) getRecoverOrProtectRequest(
s3StoreAccessor s3StoreAccessor, sourceVrgNamespaceName, sourceVrgName string,
captureToRecoverFromIdentifier *ramen.KubeObjectsCaptureIdentifier,
groupNumber int, recoverGroup kubeobjects.RecoverSpec,
veleroNamespaceName string, labels map[string]string, log logr.Logger,
labels map[string]string, log logr.Logger,
) (kubeobjects.Request, bool, func() (kubeobjects.Request, error), func(kubeobjects.Request)) {
vrg := v.instance
annotations := map[string]string{}
Expand All @@ -569,7 +569,7 @@ func (v *VRGInstance) getRecoverOrProtectRequest(
s3StoreAccessor.S3CompatibleEndpoint, s3StoreAccessor.S3Bucket, s3StoreAccessor.S3Region, pathName,
s3StoreAccessor.VeleroNamespaceSecretKeyRef,
s3StoreAccessor.CACertificates,
recoverGroup.Spec, veleroNamespaceName,
recoverGroup.Spec, v.veleroNamespaceName(),
captureName,
labels, annotations)
},
Expand Down Expand Up @@ -630,7 +630,6 @@ func (v *VRGInstance) kubeObjectsRecoveryStartOrResume(
captureToRecoverFromIdentifier *ramen.KubeObjectsCaptureIdentifier,
log logr.Logger,
) error {
veleroNamespaceName := v.veleroNamespaceName()
labels := util.OwnerLabels(v.instance)

captureRequests, err := v.getCaptureRequests()
Expand Down Expand Up @@ -662,7 +661,7 @@ func (v *VRGInstance) kubeObjectsRecoveryStartOrResume(
} else {
if err := v.executeRecoverGroup(result, s3StoreAccessor,
captureToRecoverFromIdentifier, captureRequests,
recoverRequests, veleroNamespaceName, labels, groupNumber, rg,
recoverRequests, labels, groupNumber, rg,
requests, log1); err != nil {
return err
}
Expand All @@ -679,7 +678,7 @@ func (v *VRGInstance) kubeObjectsRecoveryStartOrResume(
func (v *VRGInstance) executeRecoverGroup(result *ctrl.Result, s3StoreAccessor s3StoreAccessor,
captureToRecoverFromIdentifier *ramen.KubeObjectsCaptureIdentifier,
captureRequests, recoverRequests map[string]kubeobjects.Request,
veleroNamespaceName string, labels map[string]string, groupNumber int,
labels map[string]string, groupNumber int,
rg kubeobjects.RecoverSpec, requests []kubeobjects.Request, log1 logr.Logger,
) error {
sourceVrgName := v.instance.Name
Expand All @@ -688,7 +687,7 @@ func (v *VRGInstance) executeRecoverGroup(result *ctrl.Result, s3StoreAccessor s
captureRequests, recoverRequests, s3StoreAccessor,
sourceVrgNamespaceName, sourceVrgName,
captureToRecoverFromIdentifier,
groupNumber, rg, veleroNamespaceName, labels, log1,
groupNumber, rg, labels, log1,
)

var err error
Expand Down

0 comments on commit 5d5170d

Please sign in to comment.