fix(inference): warn when modelCache.claimName is silently ignored#966
Merged
Defilan merged 1 commit intoJul 3, 2026
Merged
Conversation
spec.modelCache.claimName only takes effect on the download-into-cache path. When that path is inactive -- caching disabled on the operator (chart modelCache.enabled=false / --model-cache-path unset) or a model without an effective cache key (local file:// source, or a remote model not yet fingerprinted) -- the pod silently fell back to an emptyDir and re-downloaded the model on every restart, with no event or condition. Emit the same ModelCacheClaimIgnored warning event already used for the pvc://-source conflict, saying why the claim was ignored and that the pod gets an ephemeral emptyDir instead. The check lives in a warnIgnoredModelCacheClaim helper next to the other claimName logic (extracted rather than inlined to keep Reconcile under the gocyclo limit). Envtest reconcile tests now assert every ModelCacheClaimIgnored variant (the pvc:// case was previously unasserted) plus the no-warning happy path. Also document that claimName is mutable and the old claim is not garbage-collected. AI assistance: authored by Claude (Fable 5) operating under the maintainer's direction; reviewed before submitting. Fixes defilantech#965 Signed-off-by: Jory Irving <jory.irving@stackadapt.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Defilan
approved these changes
Jul 3, 2026
Defilan
left a comment
Member
There was a problem hiding this comment.
Review
Approve. This closes the silent-drop gap I flagged on #960 (filed as #965): when spec.modelCache.claimName is set but caching is off, the user now gets a ModelCacheClaimIgnored warning instead of a silent emptyDir.
Verified:
warnIgnoredModelCacheClaimfires the existingModelCacheClaimIgnoredreason across all three ignore cases (pvc://source,ModelCachePath == "", empty cache key). The switch conditions are the exact negation of the realuseCachegate (effectiveModelCacheKey(model) != "" && r.ModelCachePath != ""), so the warning mirrors the actual storage path chosen.- Wired unconditionally in
ReconcilebeforereconcileDeployment(not dead code), and it back-fills the previously-inlinepvc://warning. - No false positive on the happy path (claimName set + caching on), asserted by a dedicated
NotTo(ContainElement(...))test; the envtest covers all four cases with a FakeRecorder. - Tightly scoped (helper extraction + call-site swap + tests + a docs bullet), DCO signed.
One cosmetic note: the test/doc reference #928 rather than the silent-drop follow-up #965 this resolves; I'll close #965 pointing here.
Thanks for picking this up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Emit a
ModelCacheClaimIgnoredwarning event whenspec.modelCache.claimNameis set but the cache path is inactive — caching disabled on the operator (chartmodelCache.enabled: false/--model-cache-pathunset) or the model has no effective cache key (localfile://source, or a remote model not yet fingerprinted).Why
Follow-up from the #960 review: in these cases the pod silently fell back to an emptyDir and re-downloaded the model on every restart, with no event or condition. #960 already warned for the
pvc://-source conflict; this covers the symmetric case.Fixes #965
How
useCachegate inconstructDeployment; it lives in awarnIgnoredModelCacheClaimhelper next to the other claimName logic (extracted rather than inlined because the extra branches pushedReconcileover the gocyclo limit). Event messages say why the claim was ignored and that the pod gets an ephemeral emptyDir.FakeRecorderassert everyModelCacheClaimIgnoredvariant — including the pre-existingpvc://case, which was previously unasserted — plus a no-warning case when caching is active.docs/MODEL-CACHE.md: updated the ignored-claim bullet and added a note thatclaimNameis mutable and the old claim is not garbage-collected.ModelCachePVCNotFoundcondition-reason nice-to-have: the Degraded reason is hardcoded in the sharedupdateStatusWithSchedulingInfoswitch, so a specific reason means plumbing a new parameter through it — happy to do as a separate PR if wanted.AI assistance: authored by Claude (Fable 5) operating under the maintainer's direction; reviewed before submitting.
Checklist
make testpasses locally (go test ./internal/controller/...with envtest assets, 506/506)make lintpasses locally (golangci-lint run ./internal/... ./api/..., 0 issues)git commit -s) per DCO