Skip to content

fix(storage): support pagination in Kubernetes storage GC (#4979) - #4990

Open
Retr0-XD wants to merge 1 commit into
dexidp:masterfrom
Retr0-XD:fix/issue-4979-gc-pagination
Open

fix(storage): support pagination in Kubernetes storage GC (#4979)#4990
Retr0-XD wants to merge 1 commit into
dexidp:masterfrom
Retr0-XD:fix/issue-4979-gc-pagination

Conversation

@Retr0-XD

Copy link
Copy Markdown

Fixes incomplete garbage collection in Kubernetes storage backend when deployments have more than 500 expired objects.

Problem: The Kubernetes API enforces a 500-item hard limit per list request. The GC function was not handling pagination, so it only processed the first 500 objects.

Solution: Add pagination support by capturing and using continuation tokens in the GarbageCollect function for all resource types.

Changes: Added Continue field to ListMeta, new listNWithContinue() method, and pagination loops in GarbageCollect().

Fixes #4979

The Kubernetes API enforces a 500-item hard limit per list request.
Garbage collection in Dex's Kubernetes storage was not handling
pagination, causing it to only process the first 500 objects and
miss expired items beyond that limit.

Changes:
- Add 'Continue' field to ListMeta struct to capture continuation tokens
- Add listNWithContinue() method that accepts optional continue token
- Modify GarbageCollect() to loop through all pages for each resource type:
  * AuthRequests, AuthCodes, DeviceRequests, DeviceTokens, AuthSessions
- Each resource type now properly paginates until no more items exist

This ensures garbage collection processes all expired objects in large
deployments with more than 500 items of any single resource type.

Fixes: dexidp#4979
Signed-off-by: Sakthi Harish <sakthi.harish@edgeverve.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kubernetes storage GC does not paginate beyond the first 500 objects

1 participant