Skip to content

Commit ef3b511

Browse files
authored
Merge pull request #454 from huww98/deadcode
remove dead code
2 parents 73401c9 + d50f0ae commit ef3b511

File tree

3 files changed

+4
-28
lines changed

3 files changed

+4
-28
lines changed

pkg/modifycontroller/controller.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -181,25 +181,6 @@ func (ctrl *modifyController) deletePVC(obj interface{}) {
181181
ctrl.claimQueue.Forget(objKey)
182182
}
183183

184-
// modifyPVC modifies the PVC and PV based on VAC
185-
func (ctrl *modifyController) modifyPVC(pvc *v1.PersistentVolumeClaim, pv *v1.PersistentVolume) error {
186-
var err error
187-
if isFirstTimeModifyVolumeWithPVC(pvc, pv) {
188-
// If it is first time adding a vac, always validate and then call modify volume
189-
_, _, err, _ = ctrl.validateVACAndModifyVolumeWithTarget(pvc, pv)
190-
} else {
191-
_, _, err, _ = ctrl.modify(pvc, pv)
192-
}
193-
return err
194-
}
195-
196-
func isFirstTimeModifyVolumeWithPVC(pvc *v1.PersistentVolumeClaim, pv *v1.PersistentVolume) bool {
197-
if pv.Spec.VolumeAttributesClassName == nil && pvc.Spec.VolumeAttributesClassName != nil {
198-
return true
199-
}
200-
return false
201-
}
202-
203184
func (ctrl *modifyController) init(ctx context.Context) bool {
204185
informersSyncd := []cache.InformerSynced{ctrl.pvListerSynced, ctrl.pvcListerSynced}
205186
informersSyncd = append(informersSyncd, ctrl.vacListerSynced)

pkg/modifycontroller/controller_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ func TestController(t *testing.T) {
111111
}
112112
}
113113
time.Sleep(time.Second * 2)
114-
err = ctrlInstance.modifyPVC(test.pvc, test.pv)
114+
_, _, err, _ = ctrlInstance.modify(test.pvc, test.pv)
115+
if err != nil {
116+
t.Fatalf("for %s: unexpected error: %v", test.name, err)
117+
}
115118

116119
modifyCallCount := client.GetModifyCount()
117120
if test.callCSIModify && modifyCallCount == 0 {

pkg/resizer/csi_resizer.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,3 @@ func getCredentials(k8sClient kubernetes.Interface, ref *v1.SecretReference) (ma
281281
}
282282
return credentials, nil
283283
}
284-
285-
func uniqueAccessModes(pvSpec v1.PersistentVolumeSpec) map[v1.PersistentVolumeAccessMode]bool {
286-
m := map[v1.PersistentVolumeAccessMode]bool{}
287-
for _, mode := range pvSpec.AccessModes {
288-
m[mode] = true
289-
}
290-
return m
291-
}

0 commit comments

Comments
 (0)