Skip to content

fix(cache): preserve creation-time tieredStore levels in runtime ConfigMap during sync - #6305

Open
YuvrajLamba01 wants to merge 2 commits into
fluid-cloudnative:masterfrom
YuvrajLamba01:fix/cache-preserve-tieredstore-configmap
Open

YuvrajLamba01 wants to merge 2 commits into
fluid-cloudnative:masterfrom
YuvrajLamba01:fix/cache-preserve-tieredstore-configmap

Conversation

@YuvrajLamba01

Copy link
Copy Markdown

Ⅰ. Describe what this PR does

Preserve creation-time worker.tieredStoreLevels and client.tieredStoreLevels from the existing fluid-runtime-config-<name> ConfigMap during CacheEngine.syncRuntimeValueConfigMap:

  • Factor buildRuntimeConfig, preserveTieredStoreLevels, and renderRuntimeConfigData out of generateRuntimeConfigData in pkg/ddc/cache/engine/cm.go (generateRuntimeConfigData retains its behavior for initial ConfigMap creation and direct callers).
  • When syncRuntimeValueConfigMap sees an existing ConfigMap with a valid runtime.json, preserveTieredStoreLevels restores creation-time Worker.TieredStoreLevels and Client.TieredStoreLevels before re-rendering both runtime.json and runtime.sh. Mutable fields such as Mounts, Options, and Replicas continue to sync as before.
  • Preserving from the existing ConfigMap (and falling back gracefully when no valid runtime.json exists yet) keeps hostPath.quotas, high, and low intact alongside workload-backed processMemory / emptyDir quotas, since those ConfigMap-only fields are not stored on workload pod specs.

Ⅱ. Does this pull request fix one issue?

fixes #6299

Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

  • Added TestPreserveTieredStoreLevels in pkg/ddc/cache/engine/cm_test.go covering:
    • preserving worker (processMemory + hostPath quotas/high/low) and client (emptyDir) creation-time levels while keeping mutable fields updated
    • keeping empty tieredStoreLevels empty when creation had none
    • fallback behavior on nil, empty, or malformed ConfigMap data
  • Added Ginkgo specs in pkg/ddc/cache/engine/sync_test.go:
    • should preserve creation-time worker hostPath and client tieredStore levels while updating mutable options (checking both runtime.json and runtime.sh)
    • should keep creation-time tieredStoreLevels in the runtime ConfigMap aligned with worker volumes when spec is edited (combining syncRuntimeValueConfigMap and syncRuntimeSpec against tmpfsSizeOf / memLimitOf)

Ⅳ. Describe how to verify it

go vet ./pkg/ddc/cache/...
go test -gcflags="all=-N -l" -v ./pkg/ddc/cache/...

Ⅴ. Special notes for reviews

Refs #6192, #6219. Note: preserving tieredStoreLevels from the existing runtime.json assumes the initial createRuntimeValueConfigMap wrote the creation-time configuration; if runtime.json is absent or unparseable, Sync keeps the spec-derived levels as a safe fallback.

…igMap during sync

Signed-off-by: Yuvraj Lamba <yuvrajlamba5151@gmail.com>
Signed-off-by: Yuvraj Lamba <yuvrajlamba5151@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

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.

[BUG] CacheRuntime: preserve creation-time tieredStore levels in runtime ConfigMap during Sync

1 participant