@@ -128,17 +128,11 @@ func (r *IBMObjectCSIReconciler) Reconcile(ctx context.Context, req ctrl.Request
128
128
}
129
129
// If the deletion timestamp is set, perform cleanup operations and remove a finalizer before returning from the reconciliation process.
130
130
if ! instance .GetDeletionTimestamp ().IsZero () {
131
- isFinalizerExists , err := r .ControllerHelper .HasFinalizer (instance )
132
- if err != nil {
131
+ if err := r .deleteClusterRoleBindings (instance ); err != nil {
133
132
return reconcile.Result {}, err
134
133
}
135
- // If the finalizer doesn't exist, return early, indicating that no further action is needed.
136
-
137
- if ! isFinalizerExists {
138
- return reconcile.Result {}, nil
139
- }
140
134
141
- if err := r .deleteClusterRolesAndBindings (instance ); err != nil {
135
+ if err := r .deleteClusterRoles (instance ); err != nil {
142
136
return reconcile.Result {}, err
143
137
}
144
138
@@ -460,17 +454,6 @@ func (r *IBMObjectCSIReconciler) deleteCSIDriver(instance *crutils.IBMObjectCSI)
460
454
return nil
461
455
}
462
456
463
- func (r * IBMObjectCSIReconciler ) deleteClusterRolesAndBindings (instance * crutils.IBMObjectCSI ) error {
464
- if err := r .deleteClusterRoleBindings (instance ); err != nil {
465
- return err
466
- }
467
-
468
- if err := r .deleteClusterRoles (instance ); err != nil {
469
- return err
470
- }
471
- return nil
472
- }
473
-
474
457
func (r * IBMObjectCSIReconciler ) deleteClusterRoleBindings (instance * crutils.IBMObjectCSI ) error {
475
458
clusterRoleBindings := r .getClusterRoleBindings (instance )
476
459
return r .ControllerHelper .DeleteClusterRoleBindings (clusterRoleBindings )
0 commit comments