v1alpha1

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	URI_LOCALHOST = "localhost"
	URI_REMOTE    = "remote"
)
View Source
const (
	TorrentNameLabelKey        = "manta.io/torrent-name"
	TorrentProtectionFinalizer = "manta.io/torrent-protect"
	ParentPodNameAnnoKey       = "manta.io/parent-pod-name"

	HUGGINGFACE_MODEL_HUB = "Huggingface"
)
View Source
const (
	// PendingConditionType represents the Torrent is Pending.
	PendingConditionType = "Pending"
	// ReplicateConditionType represents the Torrent is under replicating, downloading or syncing.
	ReplicateConditionType = "Replicating"
	// ReadyConditionType represents the Torrent is replicated successfully.
	ReadyConditionType = "Ready"
	// ReclaimingConditionType represents the Torrent is removing chunks.
	ReclaimingConditionType = "Reclaiming"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "manta.io", Version: "v1alpha1"}

	// 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

This section is empty.

Types

type ChunkStatus

type ChunkStatus struct {
	// Name represents the name of the chunk.
	// The chunk name is formatted as: <object hash>--<chunk number>,
	// e.g. "945c19bff66ba533eb2032a33dcc6281c4a1e032--0210", which means:
	// - the object hash is 945c19bff66ba533eb2032a33dcc6281c4a1e032
	// - the chunk is the second chunk of the total 10 chunks
	Name string `json:"name"`
	// SizeBytes represents the chunk size.
	SizeBytes int64 `json:"sizeBytes"`
	// State represents the state of the chunk, whether in Pending or Ready.
	// Chunks in Pending state will lead to Replication creation operations.
	State TrackerState `json:"state"`
}

func (*ChunkStatus) DeepCopy

func (in *ChunkStatus) DeepCopy() *ChunkStatus

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

func (*ChunkStatus) DeepCopyInto

func (in *ChunkStatus) DeepCopyInto(out *ChunkStatus)

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

type ChunkTracker

type ChunkTracker struct {
	// ChunkName represents the name of the chunk.
	ChunkName string `json:"chunkName"`
	// SizeBytes represents the chunk size.
	SizeBytes int64 `json:"sizeBytes"`
}

No file Path here is just because one chunk could be referenced by several different files, no limitations here. But one chunk could only be belonged to one repo if there's no hash conflicts, we're happy here.

func (*ChunkTracker) DeepCopy

func (in *ChunkTracker) DeepCopy() *ChunkTracker

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

func (*ChunkTracker) DeepCopyInto

func (in *ChunkTracker) DeepCopyInto(out *ChunkTracker)

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

type Hub

type Hub struct {
	// TODO: support ModelScope
	// Name refers to the model registry, such as huggingface.
	// +kubebuilder:default=Huggingface
	// +kubebuilder:validation:Enum={Huggingface}
	// +optional
	Name *string `json:"name,omitempty"`
	// RepoID refers to the identifier on hub,
	// such as meta-llama/Meta-Llama-3-8B.
	RepoID string `json:"repoID"`
	// Filename refers to a specified model file rather than the whole repo.
	// This is helpful to download a specified GGUF model rather than downloading
	// the whole repo which includes all kinds of quantized models.
	// TODO: this is only supported with Huggingface, add support for ModelScope
	// in the near future.
	Filename *string `json:"filename,omitempty"`
	// Revision refers to a Git revision id which can be a branch name, a tag, or a commit hash.
	// +kubebuilder:default=main
	// +optional
	Revision *string `json:"revision,omitempty"`
}

This is inspired by https://github.com/InftyAI/llmaz. Hub represents the model registry for model downloads.

func (*Hub) DeepCopy

func (in *Hub) DeepCopy() *Hub

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

func (*Hub) DeepCopyInto

func (in *Hub) DeepCopyInto(out *Hub)

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

type NodeTracker

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

	Spec   NodeTrackerSpec   `json:"spec,omitempty"`
	Status NodeTrackerStatus `json:"status,omitempty"`
}

NodeTracker is the Schema for the nodetrackers API

func (*NodeTracker) DeepCopy

func (in *NodeTracker) DeepCopy() *NodeTracker

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

func (*NodeTracker) DeepCopyInto

func (in *NodeTracker) DeepCopyInto(out *NodeTracker)

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

func (*NodeTracker) DeepCopyObject

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

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

type NodeTrackerList

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

NodeTrackerList contains a list of NodeTracker

func (*NodeTrackerList) DeepCopy

func (in *NodeTrackerList) DeepCopy() *NodeTrackerList

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

func (*NodeTrackerList) DeepCopyInto

func (in *NodeTrackerList) DeepCopyInto(out *NodeTrackerList)

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

func (*NodeTrackerList) DeepCopyObject

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

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

type NodeTrackerSpec

type NodeTrackerSpec struct {
	// Chunks represents a list of chunks replicated in this node.
	// +optional
	Chunks []ChunkTracker `json:"chunks,omitempty"`
	// SizeLimit sets the maximum memory reserved for chunks.
	// If nil, means no limit here, use the whole disk,
	// use 1Tib instead right now.
	// +optional
	SizeLimit *string `json:"sizeLimit,omitempty"`
}

NodeTrackerSpec defines the desired state of NodeTracker It acts like a cache.

func (*NodeTrackerSpec) DeepCopy

func (in *NodeTrackerSpec) DeepCopy() *NodeTrackerSpec

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

func (*NodeTrackerSpec) DeepCopyInto

func (in *NodeTrackerSpec) DeepCopyInto(out *NodeTrackerSpec)

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

type NodeTrackerStatus

type NodeTrackerStatus struct{}

NodeTrackerStatus defines the observed state of NodeTracker

func (*NodeTrackerStatus) DeepCopy

func (in *NodeTrackerStatus) DeepCopy() *NodeTrackerStatus

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

func (*NodeTrackerStatus) DeepCopyInto

func (in *NodeTrackerStatus) DeepCopyInto(out *NodeTrackerStatus)

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

type ObjectStatus

type ObjectStatus struct {
	// Path represents the path of the object.
	Path string `json:"path"`
	// Chunks represents the whole chunks which makes up the object.
	// +optional
	Chunks []ChunkStatus `json:"chunks,omitempty"`
	// Type represents the object type, limits to file or directory.
	// +kubebuilder:validation:Enum={file,directory}
	Type ObjectType `json:"type"`
}

ObjectStatus tracks the object info.

func (*ObjectStatus) DeepCopy

func (in *ObjectStatus) DeepCopy() *ObjectStatus

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

func (*ObjectStatus) DeepCopyInto

func (in *ObjectStatus) DeepCopyInto(out *ObjectStatus)

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

type ObjectType

type ObjectType string
const (
	FileObjectType      ObjectType = "file"
	DirectoryObjectType ObjectType = "directory"
)

type ReclaimPolicy

type ReclaimPolicy string
const (
	// RetainReclaimPolicy represents keep the files when Torrent is deleted.
	RetainReclaimPolicy ReclaimPolicy = "Retain"
	// DeleteReclaimPolicy represents delete the files when Torrent is deleted.
	DeleteReclaimPolicy ReclaimPolicy = "Delete"
)

type ReplicateState

type ReplicateState string
const (
	ReplicatingReplicateState ReplicateState = "Replicating"
	ReadyReplicateState       ReplicateState = "Ready"
)

type Replication

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

	Spec   ReplicationSpec   `json:"spec,omitempty"`
	Status ReplicationStatus `json:"status,omitempty"`
}

Replication is the Schema for the replications API

func (*Replication) DeepCopy

func (in *Replication) DeepCopy() *Replication

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

func (*Replication) DeepCopyInto

func (in *Replication) DeepCopyInto(out *Replication)

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

func (*Replication) DeepCopyObject

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

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

type ReplicationList

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

ReplicationList contains a list of Replication

func (*ReplicationList) DeepCopy

func (in *ReplicationList) DeepCopy() *ReplicationList

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

func (*ReplicationList) DeepCopyInto

func (in *ReplicationList) DeepCopyInto(out *ReplicationList)

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

func (*ReplicationList) DeepCopyObject

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

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

type ReplicationSpec

type ReplicationSpec struct {
	// NodeName represents which node should do replication.
	NodeName string `json:"nodeName"`
	// ChunkName represents the replicating chunk name.
	ChunkName string `json:"chunkName"`
	// Source represents the source file.
	// Source couldn't be nil.
	Source Target `json:"source"`
	// Destination represents the destination of the file.
	// If destination is nil, it means to delete the file.
	// +optional
	Destination *Target `json:"destination,omitempty"`
	// SizeBytes represents the chunk size.
	SizeBytes int64 `json:"sizeBytes"`
}

ReplicationSpec defines the desired state of Replication

func (*ReplicationSpec) DeepCopy

func (in *ReplicationSpec) DeepCopy() *ReplicationSpec

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

func (*ReplicationSpec) DeepCopyInto

func (in *ReplicationSpec) DeepCopyInto(out *ReplicationSpec)

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

type ReplicationStatus

type ReplicationStatus struct {
	// Conditions represents the Torrent condition.
	Conditions []metav1.Condition `json:"conditions,omitempty"`
	// Phase represents the current state.
	// +optional
	Phase *string `json:"phase,omitempty"`
}

ReplicationStatus defines the observed state of Replication

func (*ReplicationStatus) DeepCopy

func (in *ReplicationStatus) DeepCopy() *ReplicationStatus

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

func (*ReplicationStatus) DeepCopyInto

func (in *ReplicationStatus) DeepCopyInto(out *ReplicationStatus)

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

type RepoStatus

type RepoStatus struct {
	// Objects represents the whole objects belongs to the repo.
	// +optional
	Objects []ObjectStatus `json:"objects,omitempty"`
}

func (*RepoStatus) DeepCopy

func (in *RepoStatus) DeepCopy() *RepoStatus

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

func (*RepoStatus) DeepCopyInto

func (in *RepoStatus) DeepCopyInto(out *RepoStatus)

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

type Target

type Target struct {
	// URI represents the file address with different storages, e.g.:
	// 	 - oss://<bucket>.<endpoint>/<path-to-your-file>
	// 	 - localhost://<path-to-your-file>
	// 	 - remote://<node-name>@<path-to-your-file>
	// Localhost means the local host path, remote means the host path of the provided node.
	// Note: if it's a folder, all the files under the folder will be considered,
	// otherwise, only one file will be replicated.
	URI *string `json:"uri,omitempty"`
	// Hub represents the model registry for model downloads.
	// Hub and address are exclusive.
	// +optional
	Hub *Hub `json:"hub,omitempty"`
}

Target represents the to be replicated file info. Source couldn't be nil, but if destination is nil, it means to delete the file.

func (*Target) DeepCopy

func (in *Target) DeepCopy() *Target

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

func (*Target) DeepCopyInto

func (in *Target) DeepCopyInto(out *Target)

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

type Torrent

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

	Spec   TorrentSpec   `json:"spec,omitempty"`
	Status TorrentStatus `json:"status,omitempty"`
}

Torrent is the Schema for the torrents API

func (*Torrent) DeepCopy

func (in *Torrent) DeepCopy() *Torrent

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

func (*Torrent) DeepCopyInto

func (in *Torrent) DeepCopyInto(out *Torrent)

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

func (*Torrent) DeepCopyObject

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

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

type TorrentList

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

TorrentList contains a list of Torrent

func (*TorrentList) DeepCopy

func (in *TorrentList) DeepCopy() *TorrentList

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

func (*TorrentList) DeepCopyInto

func (in *TorrentList) DeepCopyInto(out *TorrentList)

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

func (*TorrentList) DeepCopyObject

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

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

type TorrentSpec

type TorrentSpec struct {
	// Preheat represents whether we should preload the model.
	// Preheat can only be transitioned from false to true, not the other way around.
	// +kubebuilder:default=true
	// +optional
	Preheat *bool `json:"preheat,omitempty"`

	// Hub represents the model registry for model downloads.
	// Hub and URI are exclusive.
	// +optional
	Hub *Hub `json:"hub,omitempty"`

	// Replicas represents the replication number of each object.
	// +kubebuilder:default=1
	// +optional
	Replicas *int32 `json:"replicas,omitempty"`
	// ReclaimPolicy represents how to handle the file replicas when Torrent is deleted.
	// Be careful to use the Delete policy because once two Torrents refer to the same
	// repo, delete one Torrent will remove the whole files.
	// +kubebuilder:default=Retain
	// +kubebuilder:validation:Enum={Retain,Delete}
	// +optional
	ReclaimPolicy *ReclaimPolicy `json:"reclaimPolicy,omitempty"`
	// TTLSecondsAfterReady represents the waiting time to delete the Torrent once Ready.
	// Default to nil indicates Torrent will not be deleted.
	// TODO: We only support nil and 0 right now.
	// +optional
	TTLSecondsAfterReady *time.Duration `json:"ttlSecondsAfterReady,omitempty"`
	// NodeSelector represents the node constraints to download the chunks.
	// It can be used to download the model to a specified node for preheating.
	// +optional
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`
}

TorrentSpec defines the desired state of Torrent

func (*TorrentSpec) DeepCopy

func (in *TorrentSpec) DeepCopy() *TorrentSpec

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

func (*TorrentSpec) DeepCopyInto

func (in *TorrentSpec) DeepCopyInto(out *TorrentSpec)

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

type TorrentStatus

type TorrentStatus struct {
	// Conditions represents the Torrent condition.
	Conditions []metav1.Condition `json:"conditions,omitempty"`
	// Repo tracks the objects belong to the source.
	Repo *RepoStatus `json:"repo,omitempty"`
	// Phase represents the current state.
	// +optional
	Phase *string `json:"phase,omitempty"`
}

TorrentStatus defines the observed state of Torrent

func (*TorrentStatus) DeepCopy

func (in *TorrentStatus) DeepCopy() *TorrentStatus

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

func (*TorrentStatus) DeepCopyInto

func (in *TorrentStatus) DeepCopyInto(out *TorrentStatus)

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

type TrackerState

type TrackerState string
const (
	// Pending means the chunk is waiting for downloading.
	PendingTrackerState TrackerState = "Pending"
	// Ready means the chunk is ready for downloading or downloaded.
	ReadyTrackerState TrackerState = "Ready"
	// Deleting means the chunk is being removed.
	DeletingTrackerState TrackerState = "Deleting"
)

type URIProtocol

type URIProtocol string

URIProtocol represents the protocol of the URI.

Jump to

Keyboard shortcuts

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