diff --git a/.golangci.yaml b/.golangci.yaml index 4c05feeecb..d8e74c633e 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -74,7 +74,7 @@ linters-settings: # - name: flag-parameter - name: unused-receiver - name: unused-parameter - # - name: confusing-naming + - name: confusing-naming - name: import-shadowing - name: confusing-results - name: bool-literal-in-expr diff --git a/controllers/drpolicy_controller.go b/controllers/drpolicy_controller.go index 03b18f9e5b..97ecdc4f9b 100644 --- a/controllers/drpolicy_controller.go +++ b/controllers/drpolicy_controller.go @@ -94,7 +94,6 @@ func (r *DRPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c } secretsUtil := &util.SecretsUtil{Client: r.Client, APIReader: r.APIReader, Ctx: ctx, Log: log} - // DRPolicy is marked for deletion if !drpolicy.ObjectMeta.DeletionTimestamp.IsZero() && controllerutil.ContainsFinalizer(drpolicy, drPolicyFinalizerName) { return ctrl.Result{}, u.deleteDRPolicy(drclusters, secretsUtil, ramenConfig) @@ -111,7 +110,6 @@ func (r *DRPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c log.Error(err, "Missing dependent resources") - // will be reconciled later based on DRCluster watch events return ctrl.Result{}, nil } @@ -127,15 +125,6 @@ func (r *DRPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c return ctrl.Result{}, fmt.Errorf("error in intiating policy metrics: %w", err) } - return r.reconcile(drpolicy, drclusters, secretsUtil, ramenConfig, log) -} - -func (*DRPolicyReconciler) reconcile(drpolicy *ramen.DRPolicy, - drclusters *ramen.DRClusterList, - secretsUtil *util.SecretsUtil, - ramenConfig *ramen.RamenConfig, - log logr.Logger, -) (ctrl.Result, error) { if err := propagateS3Secret(drpolicy, drclusters, secretsUtil, ramenConfig, log); err != nil { return ctrl.Result{}, fmt.Errorf("drpolicy deploy: %w", err) } diff --git a/controllers/volsync/vshandler.go b/controllers/volsync/vshandler.go index bbea570687..e59ffe6070 100644 --- a/controllers/volsync/vshandler.go +++ b/controllers/volsync/vshandler.go @@ -171,7 +171,7 @@ func (v *VSHandler) createOrUpdateRD( ) { l := v.log.WithValues("rdSpec", rdSpec) - volumeSnapshotClassName, err := v.GetVolumeSnapshotClassFromPVCStorageClass(rdSpec.ProtectedPVC.StorageClassName) + volumeSnapshotClassName, err := v.GetVolumeSnapshotClassFromPVCStorageClassName(rdSpec.ProtectedPVC.StorageClassName) if err != nil { return nil, err } @@ -1350,7 +1350,7 @@ func (v *VSHandler) ModifyRSSpecForCephFS(rsSpec *ramendrv1alpha1.VolSyncReplica return nil } -func (v *VSHandler) GetVolumeSnapshotClassFromPVCStorageClass(storageClassName *string) (string, error) { +func (v *VSHandler) GetVolumeSnapshotClassFromPVCStorageClassName(storageClassName *string) (string, error) { storageClass, err := v.getStorageClass(storageClassName) if err != nil { return "", err diff --git a/controllers/volsync/vshandler_test.go b/controllers/volsync/vshandler_test.go index 60673472cd..ba0293cd57 100644 --- a/controllers/volsync/vshandler_test.go +++ b/controllers/volsync/vshandler_test.go @@ -96,9 +96,9 @@ var _ = Describe("VolSync Handler - Volume Replication Class tests", func() { Expect(len(vsClasses)).To(Equal(totalVolumeSnapshotClassCount)) }) - It("GetVolumeSnapshotClassFromPVCStorageClass() should find the default volume snapshot class "+ + It("GetVolumeSnapshotClassFromPVCStorageClassName() should find the default volume snapshot class "+ "that matches the driver from the storageclass", func() { - vsClassName, err := vsHandler.GetVolumeSnapshotClassFromPVCStorageClass(&testStorageClassName) + vsClassName, err := vsHandler.GetVolumeSnapshotClassFromPVCStorageClassName(&testStorageClassName) Expect(err).NotTo(HaveOccurred()) Expect(vsClassName).To(Equal(testDefaultVolumeSnapshotClass.GetName())) @@ -138,9 +138,9 @@ var _ = Describe("VolSync Handler - Volume Replication Class tests", func() { Expect(vscBFound).To(BeTrue()) }) - It("GetVolumeSnapshotClassFromPVCStorageClass() should not find a match if no volume snapshot "+ + It("GetVolumeSnapshotClassFromPVCStorageClassName() should not find a match if no volume snapshot "+ "classes matche the driver from the storageclass", func() { - vsClassName, err := vsHandler.GetVolumeSnapshotClassFromPVCStorageClass(&testStorageClassName) + vsClassName, err := vsHandler.GetVolumeSnapshotClassFromPVCStorageClassName(&testStorageClassName) Expect(err).To(HaveOccurred()) Expect(vsClassName).To(Equal("")) Expect(err.Error()).To(ContainSubstring("unable to find matching volumesnapshotclass")) @@ -169,10 +169,10 @@ var _ = Describe("VolSync Handler - Volume Replication Class tests", func() { Expect(vsClasses[0].GetName()).To(Equal(volumeSnapshotClassB.GetName())) }) - It("GetVolumeSnapshotClassFromPVCStorageClass() should not find a match if no volume snapshot "+ + It("GetVolumeSnapshotClassFromPVCStorageClassName() should not find a match if no volume snapshot "+ "classes matche the driver from the storageclass", func() { storageClassName := storageClassAandB.GetName() - vsClassName, err := vsHandler.GetVolumeSnapshotClassFromPVCStorageClass(&storageClassName) + vsClassName, err := vsHandler.GetVolumeSnapshotClassFromPVCStorageClassName(&storageClassName) Expect(err).NotTo(HaveOccurred()) Expect(vsClassName).To(Equal(volumeSnapshotClassB.GetName())) }) diff --git a/controllers/vrg_volrep.go b/controllers/vrg_volrep.go index 79ec534045..664c5a5a64 100644 --- a/controllers/vrg_volrep.go +++ b/controllers/vrg_volrep.go @@ -80,7 +80,7 @@ func (v *VRGInstance) reconcileVolRepsAsPrimary() { // itself is assumed to be protected along with other k8s objects in the // subscription, such as, the deployment, pods, services, etc., by an // entity external to the VRG a la IaC. - if err := v.uploadPVandPVCtoS3Stores(pvc, log); err != nil { + if err := v.uploadPVandPVCtoS3Profiles(pvc, log); err != nil { log.Info("Requeuing due to failure to upload PV object to S3 store(s)", "errorValue", err) @@ -553,7 +553,7 @@ func (v *VRGInstance) isArchivedAlready(pvc *corev1.PersistentVolumeClaim, log l } // Upload PV to the list of S3 stores in the VRG spec -func (v *VRGInstance) uploadPVandPVCtoS3Stores(pvc *corev1.PersistentVolumeClaim, log logr.Logger) (err error) { +func (v *VRGInstance) uploadPVandPVCtoS3Profiles(pvc *corev1.PersistentVolumeClaim, log logr.Logger) (err error) { if v.isArchivedAlready(pvc, log) { v.log.Info("PV cluster data already protected for PVC", "PVC", pvc.Name)