v1alpha1

package
v0.1.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the dataset v1alpha1 API group +kubebuilder:object:generate=true +groupName=dataset.baizeai.io

Index

Constants

View Source
const (
	DatasetTypeGit         DatasetType = "GIT"
	DatasetTypeS3          DatasetType = "S3"
	DatasetTypePVC         DatasetType = "PVC"
	DatasetTypeNFS         DatasetType = "NFS"
	DatasetTypeHTTP        DatasetType = "HTTP"
	DatasetTypeConda       DatasetType = "CONDA"
	DatasetTypeReference   DatasetType = "REFERENCE"
	DatasetTypeHuggingFace DatasetType = "HUGGING_FACE"
	DatasetTypeModelScope  DatasetType = "MODEL_SCOPE"
	DatasetTypeDatabase    DatasetType = "DATABASE"
	DatasetTypeHadoop      DatasetType = "HADOOP"
	DatasetTypeManual      DatasetType = "MANUAL"

	// must be same as apis/management-api/dataset/v1alpha1/dataset.proto
	DatasetStatusPhasePending    DatasetStatusPhase = "PENDING"
	DatasetStatusPhaseReady      DatasetStatusPhase = "READY"
	DatasetStatusPhaseProcessing DatasetStatusPhase = "PROCESSING"
	DatasetStatusPhaseFailed     DatasetStatusPhase = "FAILED"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion       = schema.GroupVersion{Group: "dataset.baizeai.io", Version: "v1alpha1"}
	SchemeGroupVersion = GroupVersion // for client-go

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func Resource added in v0.1.7

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type AccessMode added in v0.1.13

type AccessMode string

AccessMode is the access granted to a namespace which references a Dataset. It deliberately describes a per-reference mount policy, not the access mode of the backing PersistentVolume.

const (
	AccessModeReadOnly  AccessMode = "ReadOnly"
	AccessModeReadWrite AccessMode = "ReadWrite"
)

type DataLoadStatus

type DataLoadStatus struct {
	// +kubebuilder:validation:Optional
	Round int32 `json:"round,omitempty"`
	// +kubebuilder:validation:Optional
	JobName string `json:"jobName,omitempty"`
	// +kubebuilder:validation:Optional
	StartTime metav1.Time `json:"startTime,omitempty"`
	// +kubebuilder:validation:Optional
	EndTime metav1.Time `json:"endTime,omitempty"`
	// +kubebuilder:validation:Optional
	Succeed bool `json:"succeed,omitempty"`
}

func (*DataLoadStatus) DeepCopy

func (in *DataLoadStatus) DeepCopy() *DataLoadStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataLoadStatus.

func (*DataLoadStatus) DeepCopyInto

func (in *DataLoadStatus) DeepCopyInto(out *DataLoadStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Dataset

type Dataset struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   DatasetSpec   `json:"spec,omitempty"`
	Status DatasetStatus `json:"status,omitempty"`
}

Dataset is the Schema for the datasets API +genclient +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:shortName=data +kubebuilder:printcolumn:name="type",type=string,JSONPath=`.spec.source.type` +kubebuilder:printcolumn:name="uri",type=string,JSONPath=`.spec.source.uri` +kubebuilder:printcolumn:name="phase",type=string,JSONPath=`.status.phase`

func (*Dataset) DeepCopy

func (in *Dataset) DeepCopy() *Dataset

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Dataset.

func (*Dataset) DeepCopyInto

func (in *Dataset) DeepCopyInto(out *Dataset)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Dataset) DeepCopyObject

func (in *Dataset) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type DatasetList

type DatasetList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Dataset `json:"items"`
}

DatasetList contains a list of Dataset

func (*DatasetList) DeepCopy

func (in *DatasetList) DeepCopy() *DatasetList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatasetList.

func (*DatasetList) DeepCopyInto

func (in *DatasetList) DeepCopyInto(out *DatasetList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DatasetList) DeepCopyObject

func (in *DatasetList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type DatasetSource

type DatasetSource struct {
	// +kubebuilder:validation:Enum=GIT;S3;HTTP;PVC;NFS;CONDA;REFERENCE;HUGGING_FACE;MODEL_SCOPE;DATABASE;HADOOP;MANUAL
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
	Type DatasetType `json:"type"`
	// +kubebuilder:validation:Required
	// uri is the location of the dataset.
	// each type of dataset source has its own format of uri:
	// - GIT: http[s]://<host>/<owner>/<repo>[.git] or git://<host>/<owner>/<repo>[.git]
	// - S3: s3://<bucket>/<path/to/directory>
	// - HTTP: http[s]://<host>/<path/to/directory>?<query>
	// - PVC: pvc://<name>/<path/to/directory>
	// - NFS: nfs://<host>/<path/to/directory>
	// - CONDA: conda://<name>?[python=<python_version>]
	// - REFERENCE: dataset://<namespace>/<dataset>
	// - HUGGING_FACE: huggingface://<repoName>?[repoType=<repoType>]
	// - MODEL_SCOPE: modelscope://<namespace>/<model>
	// - DATABASE: database://<ip>:<port>
	// - HADOOP: hdfs://<ip>:<port>
	// - MANUAL: manual://
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
	URI string `json:"uri"`
	// +kubebuilder:validation:Optional
	// +kubebuilder:pruning:PreserveUnknownFields
	// options is a map of key-value pairs that can be used to specify additional options for the dataset source, e.g. {"branch": "master"}
	// supported keys for each type of dataset source are:
	// - GIT: branch, commit, depth, submodules
	// - S3: region, endpoint, provider, syncMode
	// - HTTP: any key-value pair will be passed to the underlying http client as http headers
	// - PVC:
	// - NFS:
	// - CONDA: requirements.txt, environment.yaml
	// - REFERENCE:
	// - HUGGING_FACE: repo, repoType, endpoint, include, exclude, revision
	// - MODEL_SCOPE: repo, repoType, include, exclude, revision
	// * Note: syncMode can be "sync" (default) or "copy". "sync" removes files in destination that don't exist in source, "copy" only adds/updates files without removing existing ones.
	// - DATABASE: type(currently only support MySQL, other database types may be supported in the future.), host, port, dbName, tables(in the dbName), exportFormat(currently only support csv)
	// - HADOOP: coreSiteXml and hdfsSiteXml, sourcePath, username
	// - MANUAL:
	Options map[string]string `json:"options,omitempty"`
}

func (*DatasetSource) DeepCopy

func (in *DatasetSource) DeepCopy() *DatasetSource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatasetSource.

func (*DatasetSource) DeepCopyInto

func (in *DatasetSource) DeepCopyInto(out *DatasetSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DatasetSpec

type DatasetSpec struct {
	// Share indicates whether the model is shareable with others.
	// When set to true, the model can be shared according to the specified selector.
	// +kubebuilder:validation:Optional
	Share bool `json:"share,omitempty"`
	// ShareToNamespaceSelector defines a label selector to specify the namespaces
	// to which the model can be shared. Only namespaces that match the selector will have access to the model.
	// If Share is true and ShareToNamespaceSelector is empty, that means all namespaces can access this.
	// +kubebuilder:validation:Optional
	ShareToNamespaceSelector *metav1.LabelSelector `json:"shareToNamespaceSelector,omitempty"`
	// ShareAccess assigns the effective access mode to namespaces which consume
	// this Dataset through a REFERENCE Dataset. A nil value is intentionally
	// distinct from an empty value: nil preserves the legacy read-only sharing
	// behaviour.
	// +kubebuilder:validation:Optional
	ShareAccess *ShareAccess `json:"shareAccess,omitempty"`
	// +kubebuilder:validation:Required
	// source is the source of the dataset.
	Source DatasetSource `json:"source"`
	// +kubebuilder:validation:Optional
	// secretRef is the name of the secret that contains credentials for accessing the dataset source.
	SecretRef string `json:"secretRef,omitempty"`
	// +kubebuilder:validation:Optional
	// mountOptions is the options for mounting the dataset.
	MountOptions MountOptions `json:"mountOptions,omitempty"`
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:XValidation:rule="self > 0 && self - oldSelf <= 1",message="dataSyncRound can only be incremented by 1"
	// +kubebuilder:default=1
	// dataSyncRound is the number of data sync rounds to be performed."
	DataSyncRound int32 `json:"dataSyncRound,omitempty"`
	// +kubebuilder:validation:Optional
	VolumeClaimTemplate v1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"`
	// +kubebuilder:validation:Optional
	// volumeClaimRef is the reference to an existing PVC.
	VolumeClaimRef *VolumeClaimRef `json:"volumeClaimRef,omitempty"`
	// DataWarmUpResources is the resources required for data warmUp.
	// +kubebuilder:validation:Optional
	DataWarmUpResources v1.ResourceRequirements `json:"resources,omitempty"`
}

DatasetSpec defines the desired state of Dataset +kubebuilder:validation:XValidation:rule="!has(self.shareAccess) || size(self.shareAccess.rules) > 0",message="shareAccess.rules must contain at least one rule when shareAccess is configured" +kubebuilder:validation:XValidation:rule="has(self.volumeClaimRef) || self.source.type != 'PVC' || (self.source.uri.matches('^pvc://[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?([.][a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)*(/[^?#]*)?$') && size(self.source.uri.split('/')[2]) <= 253)",message="PVC dataset source URI must be pvc://<valid-pvc-name>[/<path>] when volumeClaimRef is not set"

func (*DatasetSpec) DeepCopy

func (in *DatasetSpec) DeepCopy() *DatasetSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatasetSpec.

func (*DatasetSpec) DeepCopyInto

func (in *DatasetSpec) DeepCopyInto(out *DatasetSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DatasetStatus

type DatasetStatus struct {
	// +kubebuilder:validation:Optional
	// +kubebuilder:default=PENDING
	Phase DatasetStatusPhase `json:"phase,omitempty"`
	// +kubebuilder:validation:Optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`
	// +kubebuilder:validation:Optional
	InProcessing bool `json:"inProcessing,omitempty"`
	// +kubebuilder:validation:Optional
	InProcessingRound int32 `json:"inProcessingRound,omitempty"`
	// +kubebuilder:validation:Optional
	// lastSucceedRound is the number of the last data sync round.
	LastSucceedRound int32 `json:"lastSucceedRound,omitempty"`
	// +kubebuilder:validation:Optional
	// syncRoundStatuses is a list of data sync round statuses.
	// each data sync round status contains the information of the data sync round.
	// we only keep the data sync round statuses of the last 5 data sync rounds.
	SyncRoundStatuses []DataLoadStatus `json:"syncRoundStatuses,omitempty"`
	// +kubebuilder:validation:Optional
	// pvcName is the deterministic target PVC name for the Dataset. Its
	// presence does not imply that the PVC exists or is ready; use the PVC
	// condition to determine availability.
	PVCName string `json:"pvcName,omitempty"`
	// +kubebuilder:validation:Optional
	// readOnly indicates whether the dataset is mounted as read-only.
	ReadOnly bool `json:"readOnly,omitempty"`
	// mountSources is the direct-to-root source chain from the last successful
	// MountPolicy resolution for a REFERENCE Dataset. It deliberately excludes this
	// Dataset's own PVC; that PVC is checked from status.pvcName at verification time.
	// A MountPolicy=False condition retains this binding as an anti-rebind identity pin;
	// consumers must never treat it as current authorization.
	MountSources []MountSource `json:"mountSources,omitempty"`
	LastSyncTime metav1.Time   `json:"lastSyncTime,omitempty"`
}

DatasetStatus defines the observed state of Dataset

func (*DatasetStatus) DeepCopy

func (in *DatasetStatus) DeepCopy() *DatasetStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatasetStatus.

func (*DatasetStatus) DeepCopyInto

func (in *DatasetStatus) DeepCopyInto(out *DatasetStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DatasetStatusPhase

type DatasetStatusPhase string

type DatasetType

type DatasetType string

type MountOptions

type MountOptions struct {
	// +kubebuilder:validation:Optional
	// +kubebuilder:default="/"
	// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
	// path is the path to the directory to be mounted.
	// if set to "/", the dataset will be mounted to the root of the dest volume.
	// if set to a non-empty string, the dataset will be mounted to a subdirectory of the dest volume.
	Path string `json:"path,omitempty"`
	// +kubebuilder:validation:Optional
	// +kubebuilder:default="0774"
	// +kubebuilder:validation:Pattern="^[0-7]{3,4}$"
	// mode is the permission mode of the mounted directory.
	Mode string `json:"mode,omitempty"`
	// +kubebuilder:validation:Optional
	// +kubebuilder:default=1000
	// uid is the user id of the mounted directory.
	UID int64 `json:"uid,omitempty"`
	// +kubebuilder:validation:Optional
	// +kubebuilder:default=1000
	// gid is the group id of the mounted directory.
	GID int64 `json:"gid,omitempty"`
}

func (*MountOptions) DeepCopy

func (in *MountOptions) DeepCopy() *MountOptions

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MountOptions.

func (*MountOptions) DeepCopyInto

func (in *MountOptions) DeepCopyInto(out *MountOptions)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MountSource added in v0.1.13

type MountSource struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
	UID       string `json:"uid"`
	PVCName   string `json:"pvcName"`
	PVCUID    string `json:"pvcUID"`
	PVName    string `json:"pvName"`
	PVUID     string `json:"pvUID"`
}

MountSource pins every Dataset and storage object used by a reference mount. Consumers must verify these identities before treating ReadOnly=false as a writable mount.

func (*MountSource) DeepCopy added in v0.1.13

func (in *MountSource) DeepCopy() *MountSource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MountSource.

func (*MountSource) DeepCopyInto added in v0.1.13

func (in *MountSource) DeepCopyInto(out *MountSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ShareAccess added in v0.1.13

type ShareAccess struct {
	// +kubebuilder:validation:MinItems=1
	Rules []ShareAccessRule `json:"rules"`
}

ShareAccess describes the namespace based access policy for a shared Dataset.

func (*ShareAccess) DeepCopy added in v0.1.13

func (in *ShareAccess) DeepCopy() *ShareAccess

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShareAccess.

func (*ShareAccess) DeepCopyInto added in v0.1.13

func (in *ShareAccess) DeepCopyInto(out *ShareAccess)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ShareAccessRule added in v0.1.13

type ShareAccessRule struct {
	// NamespaceSelector selects target namespaces. Empty selectors are not valid:
	// an explicit rule must name at least one label requirement.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:XValidation:rule="size(self.matchLabels) > 0 || size(self.matchExpressions) > 0",message="namespaceSelector must not be empty"
	NamespaceSelector metav1.LabelSelector `json:"namespaceSelector"`
	// +kubebuilder:validation:Enum=ReadOnly;ReadWrite
	AccessMode AccessMode `json:"accessMode"`
}

func (*ShareAccessRule) DeepCopy added in v0.1.13

func (in *ShareAccessRule) DeepCopy() *ShareAccessRule

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShareAccessRule.

func (*ShareAccessRule) DeepCopyInto added in v0.1.13

func (in *ShareAccessRule) DeepCopyInto(out *ShareAccessRule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VolumeClaimRef added in v0.1.7

type VolumeClaimRef struct {
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=253
	// +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?([.][a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?)*$"
	// name is the name of the pvc.
	Name string `json:"name"`

	// +kubebuilder:validation:Optional
	// subPath is the subPath of the pvc.
	SubPath string `json:"subPath,omitempty"`
}

func (*VolumeClaimRef) DeepCopy added in v0.1.7

func (in *VolumeClaimRef) DeepCopy() *VolumeClaimRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeClaimRef.

func (*VolumeClaimRef) DeepCopyInto added in v0.1.7

func (in *VolumeClaimRef) DeepCopyInto(out *VolumeClaimRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL