Skip to content

Commit a45bcc8

Browse files
committed
Fix delete token cache entries on object deletion
Signed-off-by: Matheus Pimenta <[email protected]>
1 parent 8b0726f commit a45bcc8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/controller/gitrepository_controller.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,9 @@ func (r *GitRepositoryReconciler) reconcileDelete(ctx context.Context, obj *sour
11161116
controllerutil.RemoveFinalizer(obj, sourcev1.SourceFinalizer)
11171117

11181118
// Cleanup caches.
1119-
r.tokenCache.DeleteEventsForObject(sourcev1.GitRepositoryKind, obj.GetName(), obj.GetNamespace())
1119+
if r.tokenCache != nil {
1120+
r.tokenCache.DeleteEventsForObject(sourcev1.GitRepositoryKind, obj.GetName(), obj.GetNamespace())
1121+
}
11201122

11211123
// Stop reconciliation as the object is being deleted
11221124
return sreconcile.ResultEmpty, nil

0 commit comments

Comments
 (0)