@@ -171,7 +171,7 @@ func (r *PersistentVolumeClaimReconciler) checkDriverSupportCapability(
171
171
logger * logr.Logger ,
172
172
annotations map [string ]string ,
173
173
driverName string ,
174
- cap Operation ) (bool , bool ) {
174
+ cap Operation ) (bool , bool , error ) {
175
175
driverSupportsCap := false
176
176
capFound := false
177
177
@@ -183,14 +183,17 @@ func (r *PersistentVolumeClaimReconciler) checkDriverSupportCapability(
183
183
driverAnnotation = krCSIAddonsDriverAnnotation
184
184
default :
185
185
logger .Info ("Unknown capability" , "Capability" , cap )
186
- return false , false
186
+ return false , false , nil
187
187
}
188
188
189
189
if drivers , ok := annotations [driverAnnotation ]; ok && slices .Contains (strings .Split (drivers , "," ), driverAnnotation ) {
190
190
driverSupportsCap = true
191
191
}
192
192
193
- conns := r .ConnPool .GetByNodeID (driverName , "" )
193
+ conns , err := r .ConnPool .GetByNodeID (driverName , "" )
194
+ if err != nil {
195
+ return false , false , err
196
+ }
194
197
for _ , conn := range conns {
195
198
for _ , c := range conn .Capabilities {
196
199
switch cap {
@@ -203,20 +206,20 @@ func (r *PersistentVolumeClaimReconciler) checkDriverSupportCapability(
203
206
}
204
207
205
208
if capFound {
206
- return false , true
209
+ return false , true , nil
207
210
}
208
211
}
209
212
}
210
213
211
214
// If the driver supports the capability but the capability is not found in connection pool,
212
215
if driverSupportsCap {
213
216
logger .Info (fmt .Sprintf ("Driver supports %s but driver is not registered in the connection pool, Requeuing request" , cap ), "DriverName" , driverName )
214
- return true , false
217
+ return true , false , nil
215
218
}
216
219
217
220
// If the driver does not support the capability, skip requeue
218
221
logger .Info (fmt .Sprintf ("Driver does not support %s, skip Requeue" , cap ), "DriverName" , driverName )
219
- return false , false
222
+ return false , false , nil
220
223
}
221
224
222
225
// determineScheduleAndRequeue determines the schedule from annotations.
@@ -957,15 +960,21 @@ func (r *PersistentVolumeClaimReconciler) getScheduleFromNS(
957
960
// Depending on requeue value, it will return ErrorConnNotFoundRequeueNeeded.
958
961
switch annotationKey {
959
962
case krcJobScheduleTimeAnnotation :
960
- requeue , keyRotationSupported := r .checkDriverSupportCapability (logger , ns .Annotations , driverName , keyRotationOp )
963
+ requeue , keyRotationSupported , err := r .checkDriverSupportCapability (logger , ns .Annotations , driverName , keyRotationOp )
964
+ if err != nil {
965
+ return "" , err
966
+ }
961
967
if keyRotationSupported {
962
968
return schedule , nil
963
969
}
964
970
if requeue {
965
971
return "" , ErrConnNotFoundRequeueNeeded
966
972
}
967
973
case rsCronJobScheduleTimeAnnotation :
968
- requeue , supportReclaimspace := r .checkDriverSupportCapability (logger , ns .Annotations , driverName , relciamSpaceOp )
974
+ requeue , supportReclaimspace , err := r .checkDriverSupportCapability (logger , ns .Annotations , driverName , relciamSpaceOp )
975
+ if err != nil {
976
+ return "" , err
977
+ }
969
978
if supportReclaimspace {
970
979
// if driver supports space reclamation,
971
980
// return schedule from ns annotation.
0 commit comments