@@ -86,7 +86,7 @@ private PostExecutionControl<P> handleDispatch(ExecutionScope<P> executionScope)
8686 }
8787
8888 Context <P > context =
89- new DefaultContext <>(executionScope .getRetryInfo (), controller , originalResource );
89+ new DefaultContext <>(executionScope .getRetryInfo (), controller , resourceForExecution );
9090 if (markedForDeletion ) {
9191 return handleCleanup (resourceForExecution , originalResource , context );
9292 } else {
@@ -234,29 +234,29 @@ private void updatePostExecutionControlWithReschedule(
234234 baseControl .getScheduleDelay ().ifPresent (postExecutionControl ::withReSchedule );
235235 }
236236
237- private PostExecutionControl <P > handleCleanup (P resource ,
237+ private PostExecutionControl <P > handleCleanup (P resourceForExecution ,
238238 P originalResource , Context <P > context ) {
239239 if (log .isDebugEnabled ()) {
240240 log .debug (
241241 "Executing delete for resource: {} with version: {}" ,
242- ResourceID .fromResource (resource ),
243- getVersion (resource ));
242+ ResourceID .fromResource (resourceForExecution ),
243+ getVersion (resourceForExecution ));
244244 }
245- DeleteControl deleteControl = controller .cleanup (resource , context );
245+ DeleteControl deleteControl = controller .cleanup (resourceForExecution , context );
246246 final var useFinalizer = controller .useFinalizer ();
247247 if (useFinalizer ) {
248248 // note that we don't reschedule here even if instructed. Removing finalizer means that
249- // cleanup is finished, nothing left to done
249+ // cleanup is finished, nothing left to be done
250250 final var finalizerName = configuration ().getFinalizerName ();
251- if (deleteControl .isRemoveFinalizer () && resource .hasFinalizer (finalizerName )) {
252- P customResource = conflictRetryingPatch (resource , originalResource , r -> {
251+ if (deleteControl .isRemoveFinalizer () && resourceForExecution .hasFinalizer (finalizerName )) {
252+ P customResource = conflictRetryingPatch (resourceForExecution , originalResource , r -> {
253253 // the operator might not be allowed to retrieve the resource on a retry, e.g. when its
254254 // permissions are removed by deleting the namespace concurrently
255255 if (r == null ) {
256256 log .warn (
257257 "Could not remove finalizer on null resource: {} with version: {}" ,
258- getUID (resource ),
259- getVersion (resource ));
258+ getUID (resourceForExecution ),
259+ getVersion (resourceForExecution ));
260260 return false ;
261261 }
262262 return r .removeFinalizer (finalizerName );
@@ -266,8 +266,8 @@ private PostExecutionControl<P> handleCleanup(P resource,
266266 }
267267 log .debug (
268268 "Skipping finalizer remove for resource: {} with version: {}. delete control: {}, uses finalizer: {}" ,
269- getUID (resource ),
270- getVersion (resource ),
269+ getUID (resourceForExecution ),
270+ getVersion (resourceForExecution ),
271271 deleteControl ,
272272 useFinalizer );
273273 PostExecutionControl <P > postExecutionControl = PostExecutionControl .defaultDispatch ();
0 commit comments