Skip to content

Conversation

@Syspretor
Copy link
Collaborator

Ⅰ. Describe what this PR does

Ⅱ. Does this pull request fix one issue?

fixes #XXXX

Ⅲ. 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

@Syspretor Syspretor requested a review from cheyang December 25, 2025 06:14
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Syspretor, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes a foundational generic CacheRuntime API for Fluid, standardizing the definition and management of cache runtimes. It introduces new Custom Resource Definitions for CacheRuntime and CacheRuntimeClass, providing a declarative approach to configure cache instances, their component specifications, and advanced tiered storage options.

Highlights

  • New CacheRuntime API: Introduced a new generic CacheRuntime Custom Resource Definition (CRD) to define and manage various cache runtimes within Fluid.
  • CacheRuntimeClass CRD: Added a CacheRuntimeClass CRD, enabling the definition of templates and topologies for different types of cache runtimes.
  • Flexible Tiered Storage: Implemented support for flexible tiered storage configurations within the CacheRuntime API, allowing for different media sources (e.g., process memory, host paths, ephemeral volumes) with configurable quotas and watermarks.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Dec 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.53%. Comparing base (0f5e6a7) to head (2d9028a).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5396   +/-   ##
=======================================
  Coverage   57.52%   57.53%           
=======================================
  Files         444      444           
  Lines       30744    30744           
=======================================
+ Hits        17687    17690    +3     
+ Misses      11443    11441    -2     
+ Partials     1614     1613    -1     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
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 a new generic CacheRuntime API, which is a significant and well-structured addition to the project. The new API definitions are clear and follow existing patterns. I have identified a few minor areas for improvement, including a naming inconsistency in a JSON tag, a misleading comment due to copy-pasting, a couple of empty structs that could benefit from explanatory comments, and some commented-out code that should be cleaned up. Overall, the changes are solid.

RuntimeComponentStatusCollection `json:",inline"`

// MountPointsStatuses represents the status of mount points specified in the bounded dataset
MountPointsStatuses []MountPointStatus `json:"mountPointsStatus,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The JSON tag mountPointsStatus is singular, while the field name MountPointsStatuses is plural. For consistency with other fields and to avoid potential confusion, it's recommended to make the JSON tag plural as well.

Suggested change
MountPointsStatuses []MountPointStatus `json:"mountPointsStatus,omitempty"`
MountPointsStatuses []MountPointStatus `json:"mountPointsStatuses,omitempty"`

type CacheRuntimeClientSpec struct {
GenericCacheRuntimeComponentCommonSpec `json:",inline"`

// TieredStore defines tiered storage configuration used by worker
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The comment for TieredStore within CacheRuntimeClientSpec states that it's for the 'worker'. This appears to be a copy-paste error from CacheRuntimeWorkerSpec. Please update the comment to correctly refer to the 'client' component.

Suggested change
// TieredStore defines tiered storage configuration used by worker
// TieredStore defines tiered storage configuration used by client

Comment on lines 83 to 84
type CacheRuntimeComponentHeadlessService struct {
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The CacheRuntimeComponentHeadlessService struct is currently empty. If this is intended as a placeholder for future enhancements, adding a comment to that effect would improve code clarity for other developers.

Suggested change
type CacheRuntimeComponentHeadlessService struct {
}
type CacheRuntimeComponentHeadlessService struct {
// This is a placeholder for future extensions.
}

Comment on lines 87 to 88
type EncryptOptionConfig struct {
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The EncryptOptionConfig struct is empty. If this is a placeholder for future use, please add a comment to clarify its purpose. This helps maintainers understand the intent.

Suggested change
type EncryptOptionConfig struct {
}
type EncryptOptionConfig struct {
// This is a placeholder for future extensions.
}

Comment on lines 363 to 385
//tieredStore:
// levels:
// - quota: 8Gi # quota will add to component.container.resource.request/limit.memory
// high: "0.99"
// low: "0.99"
// mediumSource:
// processMemory: {}

// ProcessMemoryMediumSource describes the process memory medium source
type ProcessMemoryMediumSource struct {
}

//tieredStore:
// levels:
// - quota: 8Gi
// high: "0.99"
// low: "0.99"
// path: /dev/shm
// mediumSource:
// emptyDir:{}
// ephemeral:
// volumeClaimTemplate:{}
// hostPath:{}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

These YAML examples are commented out directly in the code. To improve code clarity and maintainability, please consider moving these examples into the GoDoc for the respective structs (ProcessMemoryMediumSource and VolumeMediumSource) or removing them if they are temporary notes.

Copy link
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

This PR introduces a generic CacheRuntime API framework for Fluid, providing a standardized way to define and manage cache runtimes. The implementation includes:

  • New CacheRuntime and CacheRuntimeClass CRD definitions
  • Generic component specifications for master, worker, and client components
  • Flexible tiered storage configuration with support for process memory and volume-based storage
  • Comprehensive status tracking for runtime components and mount points

Reviewed changes

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

Show a summary per file
File Description
docs/zh/dev/api_doc.md Added comprehensive API documentation for CacheRuntime, CacheRuntimeClass, and related types with detailed field descriptions
config/crd/bases/data.fluid.io_cacheruntimes.yaml New CRD definition for CacheRuntime with full OpenAPI schema validation
charts/fluid/fluid/crds/data.fluid.io_cacheruntimes.yaml Helm chart CRD definition (identical to config/crd/bases version)
api/v1alpha1/zz_generated.deepcopy.go Auto-generated deep copy methods for all new types
api/v1alpha1/common.go New shared types for tiered storage configuration including MediumSource definitions
api/v1alpha1/cacheruntime_status.go Status definitions for GenericCacheRuntime with component-level status tracking

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

@Syspretor Syspretor marked this pull request as ready for review January 5, 2026 01:34
@Syspretor Syspretor force-pushed the feat/init-generic-cacheruntime-api branch from f52dd2b to c190d7a Compare January 6, 2026 01:44
@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Jan 6, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign cheyang for approval by writing /assign @cheyang in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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
Copy link
Collaborator

cheyang commented Jan 6, 2026

/gemini review

Copy link
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 a new generic CacheRuntime API, which is a significant and well-structured feature addition. The new API types generally follow Kubernetes conventions. I've included a few suggestions to enhance consistency and clarity in the API definitions and their accompanying documentation.

Comment on lines 114 to 124
// ReadyReplicas is the number of pods with a Ready condition.
// +optional
ReadyReplicas int32 `json:"ready,omitempty"`

// CurrentReplicas is the current number of replicas running for the component
// +optional
CurrentReplicas int32 `json:"currentReplicas,omitempty"`

// DesiredReplicas is the desired number of replicas as specified in the spec.
// +optional
DesiredReplicas int32 `json:"desired,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The JSON tags for ReadyReplicas and DesiredReplicas are ready and desired, respectively. This is slightly inconsistent with other replica-related fields like currentReplicas and deviates from common Kubernetes API conventions (e.g., readyReplicas in DeploymentStatus). To improve clarity and maintain consistency, I recommend using readyReplicas and desiredReplicas for the JSON tags.

Suggested change
// ReadyReplicas is the number of pods with a Ready condition.
// +optional
ReadyReplicas int32 `json:"ready,omitempty"`
// CurrentReplicas is the current number of replicas running for the component
// +optional
CurrentReplicas int32 `json:"currentReplicas,omitempty"`
// DesiredReplicas is the desired number of replicas as specified in the spec.
// +optional
DesiredReplicas int32 `json:"desired,omitempty"`
// ReadyReplicas is the number of pods with a Ready condition.
// +optional
ReadyReplicas int32 `json:"readyReplicas,omitempty"`
// CurrentReplicas is the current number of replicas running for the component
// +optional
CurrentReplicas int32 `json:"currentReplicas,omitempty"`
// DesiredReplicas is the desired number of replicas as specified in the spec.
// +optional
DesiredReplicas int32 `json:"desiredReplicas,omitempty"`

// - "OnDemand": Clean up the FUSE pod when it is no longer needed on a node
// - "OnRuntimeDeleted": Clean up the FUSE pod only when the CacheRuntime is deleted
// Defaults to "OnRuntimeDeleted".
// +kubebuilder:validation:Enum=OnRuntimeDeleted;"";OnDemand
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The +kubebuilder:validation:Enum for CleanPolicy includes an empty string "", but the field's comment only mentions OnDemand and OnRuntimeDeleted as supported policies. This could be confusing for users.

If the empty string is a valid value with specific semantics (e.g., for defaulting), this should be documented. Otherwise, if it's not intended for user configuration, it should be removed from the enum validation to prevent confusion.

Suggested change
// +kubebuilder:validation:Enum=OnRuntimeDeleted;"";OnDemand
// +kubebuilder:validation:Enum=OnRuntimeDeleted;OnDemand

Comment on lines 265 to 291
//tieredStore:
// levels:
// - quota: 8Gi # quota will add to component.container.resource.request/limit.memory
// high: "0.99"
// low: "0.99"
// mediumSource:
// processMemory: {}

// ProcessMemoryMediumSource describes process memory as a storage medium.
// When specified, cache data will be stored in the process's memory space,
// and the quota will be added to the container's resource requests and limits.
type ProcessMemoryMediumSource struct {
}

//tieredStore:
// levels:
// - quota: 8Gi
// high: "0.99"
// low: "0.99"
// path: /dev/shm
// mediumSource:
// emptyDir:{}
// ephemeral:
// volumeClaimTemplate:{}
// hostPath:{}

Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The commented-out YAML examples for tieredStore contain incorrect indentation and structural issues that could be misleading.

Specifically:

  • In both examples, the low field has incorrect indentation.
  • In the second example (lines 279-290):
    • path and mediumSource are incorrectly indented.
    • The path field expects a list of strings (e.g., ["/dev/shm"]), but the example shows a single string.
    • The example lists emptyDir, ephemeral, and hostPath under mediumSource, but only one can be specified at a time.

To avoid confusion, I recommend correcting these examples. Here is a revised version of the second example for reference:

// tieredStore:
//   levels:
//   - quota: 8Gi
//     high: "0.99"
//     low: "0.8"
//     path: ["/dev/shm"]
//     mediumSource:
//       emptyDir: {}
//       # Or one of the following:
//       # ephemeral:
//       #   volumeClaimTemplate: {}
//       # hostPath: {}

Copy link
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

Copilot reviewed 6 out of 11 changed files in this pull request and generated no new comments.


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

@xliuqq
Copy link
Collaborator

xliuqq commented Jan 6, 2026

/lgtm

Signed-off-by: 玖宇 <[email protected]>
@Syspretor Syspretor force-pushed the feat/init-generic-cacheruntime-api branch from c190d7a to 2d9028a Compare January 6, 2026 12:10
@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Jan 6, 2026

New changes are detected. LGTM label has been removed.

@fluid-e2e-bot fluid-e2e-bot bot removed the lgtm label Jan 6, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 6, 2026

Copy link
Member

@RongGu RongGu 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

@RongGu RongGu merged commit 0568268 into fluid-cloudnative:master Jan 7, 2026
21 of 23 checks passed
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.

4 participants