Provide a link to that doc page:
docs/zh/samples/cacheruntime/cacheruntime_spec_update.md
docs/en/samples/cacheruntime/cacheruntime_spec_update.md
What is the defect and your suggestions on improvement:
Defect
Both docs state that only runtimeVersion and resources support in-place update, and explicitly list replicas under "Unsupported Update Fields" (line 107 in both files), telling readers that "you must redeploy the CacheRuntime for changes to take effect".
This is wrong. replicas is synced in place for Master and Worker, and I verified it both by reading the code and by running it on a live cluster.
Code path
syncRuntimeSpec passes the field into ComponentSpec for both components:
// pkg/ddc/cache/engine/sync.go:205 (Master), :229 (Worker)
masterSpec := component.ComponentSpec{
Version: runtime.Spec.Master.RuntimeVersion,
Resources: resources,
Replicas: &runtime.Spec.Master.Replicas, // always non-nil
}
AdvancedStatefulSetManager.SyncComponentSpec applies it first, before image and resources:
// pkg/ddc/cache/component/advanced_statefulset_manager.go:206
// 1. Update replicas if specified and changed
if newSpec.Replicas != nil {
if s.updateReplicas(astsToUpdate, *newSpec.Replicas, logger) {
needsUpdate = true
}
}
updateReplicas (advanced_statefulset_manager.go:245) compares old vs. new and patches asts.Spec.Replicas when they differ. syncRuntimeSpec is wired into the reconcile loop at sync.go:76, so this runs on every sync — no redeployment is involved.
Note that because Replicas is always passed as a non-nil pointer, this path is unconditional for Master and Worker (when the component is enabled), unlike resources, which is only synced when the user has explicitly set it.
Verified on a live cluster
kind cluster, cacheruntime-controller:v1.1.0-versionfix, target bugtest/bugtest7.
Patched spec.worker.replicas from 1 to 2 with kubectl patch — no redeploy:
06:29:25.421 advanced_statefulset_manager.go:251 replicas changed, will update old: 1 new: 2
06:29:25.427 advanced_statefulset_manager.go:239 successfully patched advanced statefulset with new spec
Both lines carry the same reconcileID: ceed3efb-e35b-4e3b-9cac-85943422149c, so the ASTS change is attributable to this code path rather than to a coincidental helm/setup re-apply. Within ~15s the ASTS reported spec.replicas=2 and pod bugtest7-worker-1 was created. Patching back to 1 produced the mirror-image log (old: 2, new: 1) and the pod was removed.
For contrast, the periodic reconciles that ran while the spec was unchanged (06:26:23, 06:27:53, 06:29:23) all logged no spec changes detected, skip update — the sync is value-driven, so it is a no-op until the field actually changes.
Affected locations
Identical line numbers in the zh and en files:
| Line |
Claim |
| 7 |
"supports in-place updates for only the following two fields" |
| 98 |
"Aside from runtimeVersion and resources, modifying any other fields ... will not propagate" |
| 107 |
replicas listed as unsupported |
| 122 |
Summary table: "All other fields — No" |
| 125 |
"supports dynamic updates for only runtimeVersion and resources" |
Suggested fix
- Move
replicas out of the unsupported list in section 4 into section 3 ("Supported Update Fields") as its own subsection, alongside runtimeVersion and resources.
- Update the counts at lines 7, 98 and 125 from two fields to three.
- Add a summary-table row:
replicas | Yes | Automatically synced to AdvancedStatefulSet.
- Keep the scope explicit: Master and Worker only. The Client component uses a DaemonSet and has no replica field, so the existing statement about Client remains correct.
Side note
The TODO at pkg/ddc/cache/engine/sync.go:67 — // TODO: implement other logic like inplace update and replica scaling — sits directly above the syncRuntimeSpec call that implements exactly that, and looks equally stale. Worth removing in the same pass.
Provide a link to that doc page:
docs/zh/samples/cacheruntime/cacheruntime_spec_update.mddocs/en/samples/cacheruntime/cacheruntime_spec_update.mdWhat is the defect and your suggestions on improvement:
Defect
Both docs state that only
runtimeVersionandresourcessupport in-place update, and explicitly listreplicasunder "Unsupported Update Fields" (line 107 in both files), telling readers that "you must redeploy the CacheRuntime for changes to take effect".This is wrong.
replicasis synced in place for Master and Worker, and I verified it both by reading the code and by running it on a live cluster.Code path
syncRuntimeSpecpasses the field intoComponentSpecfor both components:AdvancedStatefulSetManager.SyncComponentSpecapplies it first, before image and resources:updateReplicas(advanced_statefulset_manager.go:245) compares old vs. new and patchesasts.Spec.Replicaswhen they differ.syncRuntimeSpecis wired into the reconcile loop atsync.go:76, so this runs on every sync — no redeployment is involved.Note that because
Replicasis always passed as a non-nil pointer, this path is unconditional for Master and Worker (when the component is enabled), unlikeresources, which is only synced when the user has explicitly set it.Verified on a live cluster
kind cluster,
cacheruntime-controller:v1.1.0-versionfix, targetbugtest/bugtest7.Patched
spec.worker.replicasfrom 1 to 2 withkubectl patch— no redeploy:Both lines carry the same
reconcileID: ceed3efb-e35b-4e3b-9cac-85943422149c, so the ASTS change is attributable to this code path rather than to a coincidental helm/setup re-apply. Within ~15s the ASTS reportedspec.replicas=2and podbugtest7-worker-1was created. Patching back to 1 produced the mirror-image log (old: 2, new: 1) and the pod was removed.For contrast, the periodic reconciles that ran while the spec was unchanged (06:26:23, 06:27:53, 06:29:23) all logged
no spec changes detected, skip update— the sync is value-driven, so it is a no-op until the field actually changes.Affected locations
Identical line numbers in the zh and en files:
runtimeVersionandresources, modifying any other fields ... will not propagate"replicaslisted as unsupportedruntimeVersionandresources"Suggested fix
replicasout of the unsupported list in section 4 into section 3 ("Supported Update Fields") as its own subsection, alongsideruntimeVersionandresources.replicas| Yes | Automatically synced to AdvancedStatefulSet.Side note
The TODO at
pkg/ddc/cache/engine/sync.go:67—// TODO: implement other logic like inplace update and replica scaling— sits directly above thesyncRuntimeSpeccall that implements exactly that, and looks equally stale. Worth removing in the same pass.