Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pkg/ddc/base/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,19 @@ func (info *RuntimeInfo) GetMetadataList() []datav1alpha1.Metadata {
return info.metadataList
}

// WithAnnotations creates a RuntimeInfoOption that sets the annotations field of RuntimeInfo.
// The annotations map usually comes from the Kubernetes runtime object, such as AlluxioRuntime,
// JindoRuntime, GooseFSRuntime, JuiceFSRuntime, ThinRuntime, EFCRuntime, VineyardRuntime, or CacheRuntime.
Comment on lines +229 to +230
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 a specific list of all supported runtime types in the documentation is brittle and creates a maintenance burden, as this comment will need to be updated whenever a new runtime is added to Fluid. It is better to use a more generic description with a few examples to improve maintainability and consistency with other functions in this file (e.g., GetMetadataListFromAnnotation).

Suggested change
// The annotations map usually comes from the Kubernetes runtime object, such as AlluxioRuntime,
// JindoRuntime, GooseFSRuntime, JuiceFSRuntime, ThinRuntime, EFCRuntime, VineyardRuntime, or CacheRuntime.
// The annotations map usually comes from the Kubernetes runtime object (e.g., AlluxioRuntime, JindoRuntime, etc.).

// These annotations are stored in RuntimeInfo so that other components can later retrieve them through
// GetAnnotations and use them when building, reconciling, or processing runtime-related resources.
// The function itself does not validate, copy, or transform the input annotations map; it directly assigns
// the provided map to RuntimeInfo.annotations.
//
// Parameters:
// - annotations: A map containing annotation key-value pairs associated with the runtime object.
//
// Returns:
// - RuntimeInfoOption: An option function that writes the given annotations into RuntimeInfo.
func WithAnnotations(annotations map[string]string) RuntimeInfoOption {
return func(info *RuntimeInfo) error {
info.annotations = annotations
Expand Down
Loading