Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURES] 允许 mounts 为空. Add 'allowEmptyMounts' field to allow 'mounts' to be empty. #4322

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion api/v1alpha1/dataset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,19 @@ type DataRestoreLocation struct {
}

// DatasetSpec defines the desired state of Dataset
// +kubebuilder:validation:XValidation:rule="self.allowEmptyMounts == true || (has(self.mounts) && size(self.mounts) >= 1)",message="Mounts must have at least one item unless AllowEmptyMounts is true"
type DatasetSpec struct {
// Mount Points to be mounted on cache runtime. <br>
// This field can be empty because some runtimes don't need to mount external storage (e.g.
// <a href="https://v6d.io/">Vineyard</a>).
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:UniqueItems=false
// +optional
Mounts []Mount `json:"mounts,omitempty"`

// AllowEmptyMounts indicates whether Mounts can be empty
// +optional
AllowEmptyMounts bool `json:"allowEmptyMounts,omitempty"`

// The owner of the dataset
// +optional
Owner *User `json:"owner,omitempty"`
Expand Down
9 changes: 8 additions & 1 deletion charts/fluid/fluid/crds/data.fluid.io_datasets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ spec:
items:
type: string
type: array
allowEmptyMounts:
description: AllowEmptyMounts indicates whether Mounts can be empty
type: boolean
dataRestoreLocation:
description: DataRestoreLocation is the location to load data of dataset been
backuped
Expand Down Expand Up @@ -159,7 +162,6 @@ spec:
required:
- mountPoint
type: object
minItems: 1
type: array
nodeAffinity:
description: |-
Expand Down Expand Up @@ -378,6 +380,11 @@ spec:
type: object
type: array
type: object
x-kubernetes-validations:
- message: Mounts must have at least one item unless AllowEmptyMounts
is true
rule: self.allowEmptyMounts == true || (has(self.mounts) && size(self.mounts)
>= 1)
status:
description: DatasetStatus defines the observed state of Dataset
properties:
Expand Down
9 changes: 8 additions & 1 deletion config/crd/bases/data.fluid.io_datasets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ spec:
items:
type: string
type: array
allowEmptyMounts:
description: AllowEmptyMounts indicates whether Mounts can be empty
type: boolean
dataRestoreLocation:
description: DataRestoreLocation is the location to load data of dataset been
backuped
Expand Down Expand Up @@ -159,7 +162,6 @@ spec:
required:
- mountPoint
type: object
minItems: 1
type: array
nodeAffinity:
description: |-
Expand Down Expand Up @@ -378,6 +380,11 @@ spec:
type: object
type: array
type: object
x-kubernetes-validations:
- message: Mounts must have at least one item unless AllowEmptyMounts
is true
rule: self.allowEmptyMounts == true || (has(self.mounts) && size(self.mounts)
>= 1)
status:
description: DatasetStatus defines the observed state of Dataset
properties:
Expand Down
Loading