Skip to content

Commit

Permalink
Merge pull request #454 from huww98/deadcode
Browse files Browse the repository at this point in the history
remove dead code
  • Loading branch information
k8s-ci-robot authored Dec 3, 2024
2 parents 73401c9 + d50f0ae commit ef3b511
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
19 changes: 0 additions & 19 deletions pkg/modifycontroller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,25 +181,6 @@ func (ctrl *modifyController) deletePVC(obj interface{}) {
ctrl.claimQueue.Forget(objKey)
}

// modifyPVC modifies the PVC and PV based on VAC
func (ctrl *modifyController) modifyPVC(pvc *v1.PersistentVolumeClaim, pv *v1.PersistentVolume) error {
var err error
if isFirstTimeModifyVolumeWithPVC(pvc, pv) {
// If it is first time adding a vac, always validate and then call modify volume
_, _, err, _ = ctrl.validateVACAndModifyVolumeWithTarget(pvc, pv)
} else {
_, _, err, _ = ctrl.modify(pvc, pv)
}
return err
}

func isFirstTimeModifyVolumeWithPVC(pvc *v1.PersistentVolumeClaim, pv *v1.PersistentVolume) bool {
if pv.Spec.VolumeAttributesClassName == nil && pvc.Spec.VolumeAttributesClassName != nil {
return true
}
return false
}

func (ctrl *modifyController) init(ctx context.Context) bool {
informersSyncd := []cache.InformerSynced{ctrl.pvListerSynced, ctrl.pvcListerSynced}
informersSyncd = append(informersSyncd, ctrl.vacListerSynced)
Expand Down
5 changes: 4 additions & 1 deletion pkg/modifycontroller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ func TestController(t *testing.T) {
}
}
time.Sleep(time.Second * 2)
err = ctrlInstance.modifyPVC(test.pvc, test.pv)
_, _, err, _ = ctrlInstance.modify(test.pvc, test.pv)
if err != nil {
t.Fatalf("for %s: unexpected error: %v", test.name, err)
}

modifyCallCount := client.GetModifyCount()
if test.callCSIModify && modifyCallCount == 0 {
Expand Down
8 changes: 0 additions & 8 deletions pkg/resizer/csi_resizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,3 @@ func getCredentials(k8sClient kubernetes.Interface, ref *v1.SecretReference) (ma
}
return credentials, nil
}

func uniqueAccessModes(pvSpec v1.PersistentVolumeSpec) map[v1.PersistentVolumeAccessMode]bool {
m := map[v1.PersistentVolumeAccessMode]bool{}
for _, mode := range pvSpec.AccessModes {
m[mode] = true
}
return m
}

0 comments on commit ef3b511

Please sign in to comment.