fix(cache): emit warning event on tieredStore drift and document update limitations #6219
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #6219"
general
weight: 0.35
cheyang
Ⅰ. Describe what this PR does
When
spec.worker.tieredStoreis updated on an existingCacheRuntime, the runtime configuration ConfigMap (fluid-runtime-config-<name>) is recomputed from spec on every sync (cm.go:102), but the worker pod volumes (emptyDir.sizeLimit, emptyDir storage medium, memory tmpfs/dev/shm) cannot be updated in-place bySyncComponentSpecwithout pod recreation.This caused an undetected split between the ConfigMap and the worker pod volumes:
This PR addresses the issue by:
1. Adding worker
tieredStoredrift detection (checkWorkerTieredStoreDrift) insyncRuntimeSpec(pkg/ddc/cache/engine/sync.go):- Compares level-by-level quotas in
runtime.Spec.Worker.TieredStore.Levelsagainst the actualsizeLimitof worker pod volumes (Quantity.Cmp).- Compares
emptyDirstorage media (Medium) to detect disk $\leftrightarrow$ Memory flips.- Checks both
processMemoryandemptyDirvolumes by their deterministic names (getMemoryTieredStoreVolumeName,getTieredStoreVolumeName).- Verifies declared
hostPathpaths match the pod's volume configurations.- Detects removed or orphaned tieredStore volumes on the worker pod.
- Modularized into low-complexity helpers (
checkProcessMemoryDrift,checkEmptyDirDrift,checkHostPathDrift).2. Emits a
RuntimeTieredStoreConflictWarning event on theCacheRuntimeobject when drift is detected.- Remediation guidance directs users: "Delete and recreate the CacheRuntime to apply changes."
- Throttles the Warning event to a 10-minute interval (
e.getTieredStoreWarningInterval()) to prevent event spam while ensuring the event remains visible within the default 1-hour Kubernetes event TTL.- Automatically resets the cooldown when the split is resolved.
3. Ensures worker
PodSpecis read during sync even when neitherCacheRuntimenorCacheRuntimeClassdeclares resources (closing the gap wherepodSpecwas only read insideif workerResources != nil).4. Adds end-to-end controller loop verification in
test/gha-e2e/curvine/test.sh(verify_tieredstore_drift_warning) asserting that a real controller detectstieredStoredrift on patch, emitsRuntimeTieredStoreConflict, and resets upon reversal.5. Documents that
spec.worker.tieredStorecannot be updated in-place and details the drift warning behavior in both English and Chinese documentation (cacheruntime_spec_update.mdandcache_runtime_tieredstore.md).Ⅱ. Does this pull request fix one issue?
fixes #6192
Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.
Added unit test suite in
pkg/ddc/cache/engine/sync_test.go(Context("tiered store drift detection and warning")):should not emit a warning event when tiered store matches worker pod volumes: verifies 0 warning events when volumes match spec (both processMemory and emptyDir).should emit a Warning event when processMemory quota in spec drifts from worker volume sizeLimit: verifiesRuntimeTieredStoreConflictevent and error description forprocessMemoryquota drift.should emit a Warning event when emptyDir quota in spec drifts from worker volume sizeLimit: verifies Warning event foremptyDirquota drift.should emit a Warning event when emptyDir medium is edited from disk to Memory: verifies Warning event for emptyDir medium drift.should emit a Warning event when emptyDir medium is edited from Memory to disk: verifies Warning event for emptyDir medium drift.should emit a Warning event when hostPath paths are edited: verifies Warning event forhostPathpath changes.should emit a Warning event when a new level is added to spec that worker pod lacks: verifies Warning event for newly added levels.should emit a Warning event when a tieredStore volume exists on pod but was removed from spec: verifies Warning event for orphaned volumes.should throttle warning events and re-emit only after interval expires: verifies rate-limiting within 10 minutes and re-emission after expiration.should reset throttling cooldown when drift is resolved: verifies cooldown reset upon resolution and immediate re-triggering on subsequent drift.should detect drift even when neither CacheRuntime nor template declares worker resources: verifies drift detection runs whenworkerResources == nil.should return gracefully when podSpec is nil: verifies nil safety.should detect missing volume for processMemory level: verifies missing volume detection.should detect missing volume for hostPath level: verifies missing volume detection for host paths.should return error when reading worker pod spec fails: verifies error propagation and logging whenGetPodSpecfails.test/gha-e2e/curvine/test.sh(verify_tieredstore_drift_warning): patchescacheruntime curvine-demoemptyDir quota, asserts event emission, and reverts.100% statement coverage achieved across all new functions and branches.
Ⅳ. Describe how to verify it
1. Run unit tests with inlining disabled for gomonkey:
2. Verify code coverage:
Ⅴ. Special notes for reviews
Client-side tieredStore drift detection (
spec.client.tieredStore) is tracked in #6221 as a follow-up, as the client DaemonSet currently uses an OnDelete/immutable model. When the validating webhook (#6193) is disabled, controller event-based detection will provide the detection fallback.