Skip to content

feat: add PVC inspection to cache list for orphaned entry detection#183

Merged
Defilan merged 3 commits intomainfrom
feat/cache-list-pvc-inspection
Feb 24, 2026
Merged

feat: add PVC inspection to cache list for orphaned entry detection#183
Defilan merged 3 commits intomainfrom
feat/cache-list-pvc-inspection

Conversation

@Defilan
Copy link
Member

@Defilan Defilan commented Feb 24, 2026

Summary

Closes #56

  • Enhances llmkube cache list to inspect actual PVC contents by exec'ing into a pod that mounts the model cache PVC, enabling detection of orphaned cache entries and real disk usage
  • Adds --orphaned flag to filter to only orphaned entries (files on PVC with no corresponding Model CR)
  • Falls back gracefully to CR-only output when PVC is absent or inspection fails
  • Adds comprehensive unit tests (40 test cases) and E2E tests (7 test cases against Kind cluster)

Test plan

  • make test passes — all unit tests including 25 new cache inspection tests
  • make lint passes — 0 issues
  • make test-e2e — E2E tests validate full PVC inspection flow:
    • Cache list shows STATUS column and PVC-derived sizes after model download
    • Orphaned entries detected when fake directory exists on PVC without Model CR
    • --orphaned flag filters correctly
    • Inspector pod is created and cleaned up when no existing pods mount the PVC
    • Graceful fallback to CR-only output when no PVC exists

)

Enhance `llmkube cache list` to inspect actual PVC contents by exec'ing
into a pod that mounts the model cache PVC. This enables detection of
orphaned cache entries (files on disk with no corresponding Model CR)
and shows real disk usage instead of stale status values.

- Add PVC inspection logic that finds an existing running pod or creates
  a temporary busybox inspector pod, runs `du -sb`, then parses output
- Merge PVC entries with Model CR data to show active vs orphaned status
- Add STATUS column to cache list output when PVC inspection succeeds
- Add --orphaned flag to filter to orphaned-only entries
- Graceful fallback to CR-only output when PVC is absent or inspection fails
- Add formatBytes utility for human-readable byte sizes
- Add comprehensive unit tests for all new functions
- Add E2E tests covering full PVC inspection flow against Kind cluster

Signed-off-by: Christopher Maher <christopher.maher@gmail.com>
Signed-off-by: Christopher Maher <chris@mahercode.io>
The cache E2E tests were in a separate top-level Describe block that
didn't share the CRD/controller lifecycle from the Manager Describe.
This caused failures because CRDs were either not yet installed or
already uninstalled when cache tests ran.

Move all cache test contexts into the Manager Describe block so they
run between BeforeAll (CRD install) and AfterAll (CRD cleanup).
Delete the standalone cache_e2e_test.go file.

Signed-off-by: Defilan <noreply@defilan.com>
Signed-off-by: Christopher Maher <chris@mahercode.io>
The model cache PVC (llmkube-model-cache) is created by the
InferenceService controller, not the Model controller. The cache
E2E tests were only creating a Model CR, so no PVC existed and
inspectPVCCache fell back to CR-only output without the STATUS column.

Add an InferenceService CR and wait for PVC creation before running
cache list assertions that depend on PVC inspection.

Signed-off-by: Defilan <noreply@defilan.com>
Signed-off-by: Christopher Maher <chris@mahercode.io>
@Defilan Defilan merged commit 2723d92 into main Feb 24, 2026
15 checks passed
@Defilan Defilan deleted the feat/cache-list-pvc-inspection branch February 24, 2026 04:29
@github-actions github-actions bot mentioned this pull request Feb 23, 2026
@github-actions github-actions bot mentioned this pull request Mar 4, 2026
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.

cache list should show actual PVC contents, not just Model CRs

1 participant