Skip to content

Extend Cache runtime framework Phase 1: add reconcile logic, left main functions to implement in next phase#5738

Merged
cheyang merged 5 commits intofluid-cloudnative:masterfrom
xliuqq:cache-runtime-framework
Apr 4, 2026
Merged

Extend Cache runtime framework Phase 1: add reconcile logic, left main functions to implement in next phase#5738
cheyang merged 5 commits intofluid-cloudnative:masterfrom
xliuqq:cache-runtime-framework

Conversation

@xliuqq
Copy link
Copy Markdown
Collaborator

@xliuqq xliuqq commented Mar 29, 2026

Ⅰ. Describe what this PR does

Add CacheRuntime Reconciler logic, leave main functions empty.

Ⅱ. Does this pull request fix one issue?

part of #5412

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

The CacheRuntime image can only be built manually — pushing is disabled as it is not yet ready.

Next phase is to implement related functions for integrating curvine.

@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot Bot commented Mar 29, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the CacheRuntime and its corresponding controller to the Fluid project. The changes encompass new CRD definitions, Helm chart templates for deployment and RBAC, a dedicated Dockerfile, and the initial implementation of the controller and engine logic. Review feedback highlights several areas for improvement: a copy-paste error in the status update logic, hardcoded namespaces in Helm templates that should be parameterized, and Dockerfile optimizations to reduce image size and remove hardcoded timezones. Additionally, there is a request for consistency in the Makefile's build arguments and the removal of misleading log messages.

Comment thread pkg/ddc/cache/engine/status.go Outdated
Comment thread charts/fluid/fluid/templates/role/cache/rbac.yaml Outdated
Comment thread docker/Dockerfile.cacheruntime Outdated
Comment thread pkg/ddc/cache/engine/dataset.go Outdated
Comment thread Makefile Outdated
Comment on lines +17 to +18
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hardcoding the timezone to Asia/Shanghai is not ideal for a container image that might be used globally. It's better to either use UTC as a default or not set a specific timezone at all, allowing the environment to determine it if necessary. Please consider removing these lines or changing the timezone to UTC.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 29, 2026

Codecov Report

❌ Patch coverage is 5.33597% with 479 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.30%. Comparing base (e773def) to head (6e71163).
⚠️ Report is 17 commits behind head on master.

Files with missing lines Patch % Lines
cmd/cache/app/cache.go 0.00% 79 Missing ⚠️
pkg/ddc/cache/engine/dataset.go 0.00% 57 Missing ⚠️
pkg/ddc/cache/engine/setup.go 0.00% 57 Missing ⚠️
pkg/ddc/cache/engine/status.go 0.00% 49 Missing ⚠️
pkg/ddc/cache/engine/engine.go 0.00% 34 Missing ⚠️
pkg/ddc/cache/engine/volume.go 0.00% 24 Missing ⚠️
pkg/ddc/cache/engine/client.go 0.00% 22 Missing ⚠️
pkg/ddc/cache/engine/master.go 0.00% 22 Missing ⚠️
pkg/ddc/cache/engine/worker.go 0.00% 22 Missing ⚠️
pkg/ddc/cache/engine/sync.go 0.00% 20 Missing ⚠️
... and 14 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5738      +/-   ##
==========================================
- Coverage   61.22%   60.30%   -0.93%     
==========================================
  Files         444      465      +21     
  Lines       30557    31049     +492     
==========================================
+ Hits        18710    18723      +13     
- Misses      10307    10786     +479     
  Partials     1540     1540              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xliuqq xliuqq force-pushed the cache-runtime-framework branch from 6f7d3f3 to 1ef0b78 Compare March 29, 2026 06:30
xliuqq added 3 commits March 29, 2026 14:36
Signed-off-by: xliuqq <xlzq1992@gmail.com>
Signed-off-by: xliuqq <xlzq1992@gmail.com>
Signed-off-by: xliuqq <xlzq1992@gmail.com>
@xliuqq xliuqq force-pushed the cache-runtime-framework branch from 1ef0b78 to 266cb37 Compare March 29, 2026 06:38
Signed-off-by: xliuqq <xlzq1992@gmail.com>
@xliuqq xliuqq marked this pull request as ready for review March 29, 2026 07:38
@xliuqq xliuqq requested review from Syspretor and cheyang March 29, 2026 07:39
@cheyang cheyang requested a review from Copilot March 30, 2026 02:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an initial “Phase 1” integration for a new CacheRuntime controller/engine, wiring it into the existing runtime reconciliation framework and Helm deployment, while leaving core engine behaviors as TODOs for a follow-up phase (curvine integration).

Changes:

  • Introduces CacheRuntime engine scaffolding and a dedicated cacheruntime-controller binary/controller.
  • Wires CacheRuntime into engine factory/runtime watch/precheck paths and extends runtime info lookup to include CacheRuntime.
  • Updates CRDs/RBAC/Helm chart templates and values to support deploying the new controller and cluster-scoped CacheRuntimeClass.

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
pkg/utils/runtimes.go Add getters for CacheRuntime / CacheRuntimeClass
pkg/runtime/context.go Clarify EngineImpl usage in reconcile context
pkg/ddc/factory.go Register Cache engine build in factory
pkg/ddc/cache/engine/worker.go Cache worker setup scaffolding
pkg/ddc/cache/engine/volume.go Cache PV/PVC volume scaffolding (TODO)
pkg/ddc/cache/engine/validate.go Cache Validate stub
pkg/ddc/cache/engine/ufs.go Cache UFS preparation stub
pkg/ddc/cache/engine/transform.go Cache transform stub for runtime values
pkg/ddc/cache/engine/sync.go Cache Sync stub + retry duration helper
pkg/ddc/cache/engine/status.go Cache status update scaffolding
pkg/ddc/cache/engine/shutdown.go Cache Shutdown stub
pkg/ddc/cache/engine/setup.go Cache Setup reconcile flow scaffolding
pkg/ddc/cache/engine/runtime.go Helper to fetch CacheRuntime
pkg/ddc/cache/engine/master.go Cache master setup scaffolding
pkg/ddc/cache/engine/engine.go CacheEngine struct + Build + Precheck
pkg/ddc/cache/engine/dataset.go Dataset bind/status update logic for cache
pkg/ddc/cache/engine/data_operation.go Data operation “not supported” scaffolding
pkg/ddc/cache/engine/cm.go Runtime-value ConfigMap creation stub
pkg/ddc/cache/engine/client.go Cache client setup scaffolding
pkg/ddc/base/runtime.go Add CacheRuntime handling in runtime info
pkg/ddc/base/interface.go Add CacheRuntimeInterface for watch support
pkg/ctrl/watch/runtime.go Allow watching CacheRuntime via new interface
pkg/controllers/v1alpha1/cacheruntime/implement.go Engine map management for CacheRuntime reconciler
pkg/controllers/v1alpha1/cacheruntime/cacheruntime_controller.go New CacheRuntime controller reconciler
pkg/controllers/deploy/runtime_controllers.go Add cacheruntime-controller precheck
pkg/common/cacheruntime.go Add CacheRuntime constants and value structs
docker/Dockerfile.cacheruntime New Dockerfile for cacheruntime-controller
config/rbac/role.yaml Add RBAC rules for cacheruntimes
config/crd/bases/data.fluid.io_cacheruntimeclasses.yaml Make CacheRuntimeClass cluster-scoped (base CRD)
cmd/cache/main.go New cacheruntime-controller main
cmd/cache/app/version.go Add version subcommand
cmd/cache/app/init.go Cobra command wiring
cmd/cache/app/cache.go Manager/controller startup for cache controller
charts/fluid/fluid/values.yaml Add Helm values for cache controller
charts/fluid/fluid/templates/role/dataset/rbac.yaml Allow dataset role access to cacheruntimes
charts/fluid/fluid/templates/role/csi/rbac.yaml Allow CSI role access to cacheruntimes
charts/fluid/fluid/templates/role/cache/rbac.yaml Add RBAC for cacheruntime-controller
charts/fluid/fluid/templates/controller/cacheruntime_controller.yaml Add cacheruntime-controller Deployment
charts/fluid/fluid/crds/data.fluid.io_cacheruntimeclasses.yaml Make CacheRuntimeClass cluster-scoped (chart CRD)
api/v1alpha1/cacheruntimeclass_types.go Consolidate kubebuilder resource tags
api/v1alpha1/cacheruntime_types.go Add GetStatus() for CacheRuntimeInterface
Makefile Add build/docker targets for cacheruntime-controller

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/ddc/cache/engine/data_operation.go Outdated
Comment thread pkg/ddc/cache/engine/volume.go
Comment thread pkg/ddc/cache/engine/status.go
Comment thread cmd/cache/app/cache.go
Comment thread docker/Dockerfile.cacheruntime
Comment thread pkg/ddc/cache/engine/transform.go Outdated
Comment thread pkg/ddc/cache/engine/status.go
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: cacheruntime-controller
{{ include "fluid.controlplane.affinity" . | nindent 6}}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a whitespace before "}}" in the template directive.

@cheyang cheyang requested a review from TrafalgarZZZ March 30, 2026 07:04
Comment thread pkg/ddc/cache/engine/transform.go
"time"
)

func (e *CacheEngine) setMasterComponentStatus(status *fluidapi.RuntimeComponentStatus) (ready bool, err error) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a framework PR, leaving the real status checks for a later phase makes sense. The risky part is that this placeholder currently returns ready=true. Once the component is enabled, that will let an unfinished runtime be reported as ready. It would be safer to return false (or an explicit not-implemented error) until the actual readiness checks are in place.

Comment thread pkg/ddc/cache/engine/volume.go
Comment thread pkg/ddc/cache/engine/data_operation.go
Signed-off-by: xliuqq <xlzq1992@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

@xliuqq xliuqq requested a review from cheyang April 1, 2026 15:02
Copy link
Copy Markdown
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot Bot commented Apr 4, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cheyang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cheyang cheyang merged commit 1c1d870 into fluid-cloudnative:master Apr 4, 2026
17 of 18 checks passed
@xliuqq xliuqq deleted the cache-runtime-framework branch April 4, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants