Skip to content

Commit

Permalink
Update ClusterLocalModel to LocalModelCache (kserve#4105)
Browse files Browse the repository at this point in the history
* Update ClusterLocalModel to LocalModelCache

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Fix generation fmt

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* black fmt

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Fix generated code

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Run go mod tidy

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Fix model status

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

---------

Signed-off-by: Dan Sun <dsun20@bloomberg.net>
  • Loading branch information
yuzisun authored Dec 9, 2024
1 parent 0c3af02 commit c9cc812
Show file tree
Hide file tree
Showing 50 changed files with 1,212 additions and 1,131 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ deploy-dev: manifests
cd config/default && if [ ${KSERVE_ENABLE_SELF_SIGNED_CA} != false ]; then \
echo > ../certmanager/certificate.yaml; \
else git checkout HEAD -- ../certmanager/certificate.yaml; fi;
kubectl apply --server-side=true -k config/overlays/development
kubectl apply --server-side=true --force-conflicts -k config/overlays/development
if [ ${KSERVE_ENABLE_SELF_SIGNED_CA} != false ]; then ./hack/self-signed-ca.sh; fi;
# TODO: Add runtimes as part of default deployment
kubectl wait --for=condition=ready pod -l control-plane=kserve-controller-manager -n kserve --timeout=300s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.2
name: clusterlocalmodels.serving.kserve.io
name: localmodelcaches.serving.kserve.io
spec:
group: serving.kserve.io
names:
kind: ClusterLocalModel
listKind: ClusterLocalModelList
plural: clusterlocalmodels
singular: clusterlocalmodel
kind: LocalModelCache
listKind: LocalModelCacheList
plural: localmodelcaches
singular: localmodelcache
scope: Cluster
versions:
- name: v1alpha1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.2
name: clusterlocalmodels.serving.kserve.io
name: localmodelcaches.serving.kserve.io
spec:
group: serving.kserve.io
names:
kind: ClusterLocalModel
listKind: ClusterLocalModelList
plural: clusterlocalmodels
singular: clusterlocalmodel
kind: LocalModelCache
listKind: LocalModelCacheList
plural: localmodelcaches
singular: localmodelcache
scope: Cluster
versions:
- name: v1alpha1
Expand Down Expand Up @@ -73,9 +73,6 @@ spec:
- NodeDownloading
- NodeDownloaded
- NodeDownloadError
- NodeDeleting
- NodeDeletionError
- NodeDeleted
type: string
type: object
type: object
Expand Down
14 changes: 7 additions & 7 deletions charts/kserve-resources/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,6 @@ rules:
- get
- patch
- update
- apiGroups:
- serving.kserve.io
resources:
- clusterlocalmodels
verbs:
- get
- list
- apiGroups:
- serving.kserve.io
resources:
Expand Down Expand Up @@ -185,3 +178,10 @@ rules:
- get
- patch
- update
- apiGroups:
- serving.kserve.io
resources:
- localmodelcaches
verbs:
- get
- list
22 changes: 11 additions & 11 deletions charts/kserve-resources/templates/localmodel/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,33 @@ rules:
- apiGroups:
- serving.kserve.io
resources:
- clusterlocalmodels
- localmodelnodes
- inferenceservices
- localmodelnodegroups
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- serving.kserve.io
resources:
- clusterlocalmodels/status
- localmodelcaches
- localmodelnodes
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- serving.kserve.io
resources:
- inferenceservices
- localmodelnodegroups
- localmodelcaches/status
verbs:
- get
- list
- watch
- patch
- update
- apiGroups:
- serving.kserve.io
resources:
Expand Down
2 changes: 1 addition & 1 deletion config/crd/full/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ resources:
- serving.kserve.io_servingruntimes.yaml
- serving.kserve.io_inferencegraphs.yaml
- serving.kserve.io_clusterstoragecontainers.yaml
- serving.kserve.io_clusterlocalmodels.yaml
- serving.kserve.io_localmodelcaches.yaml
- serving.kserve.io_localmodelnodegroups.yaml
- serving.kserve.io_localmodelnodes.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.2
name: clusterlocalmodels.serving.kserve.io
name: localmodelcaches.serving.kserve.io
spec:
group: serving.kserve.io
names:
kind: ClusterLocalModel
listKind: ClusterLocalModelList
plural: clusterlocalmodels
singular: clusterlocalmodel
kind: LocalModelCache
listKind: LocalModelCacheList
plural: localmodelcaches
singular: localmodelcache
scope: Cluster
versions:
- name: v1alpha1
Expand Down Expand Up @@ -72,9 +73,6 @@ spec:
- NodeDownloading
- NodeDownloaded
- NodeDownloadError
- NodeDeleting
- NodeDeletionError
- NodeDeleted
type: string
type: object
type: object
Expand Down
2 changes: 1 addition & 1 deletion config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resources:
- full/serving.kserve.io_servingruntimes.yaml
- full/serving.kserve.io_inferencegraphs.yaml
- full/serving.kserve.io_clusterstoragecontainers.yaml
- full/serving.kserve.io_clusterlocalmodels.yaml
- full/serving.kserve.io_localmodelcaches.yaml
- full/serving.kserve.io_localmodelnodegroups.yaml
- full/serving.kserve.io_localmodelnodes.yaml

Expand Down
2 changes: 1 addition & 1 deletion config/crd/minimal/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ resources:
- serving.kserve.io_servingruntimes.yaml
- serving.kserve.io_inferencegraphs.yaml
- serving.kserve.io_clusterstoragecontainers.yaml
- serving.kserve.io_clusterlocalmodels.yaml
- serving.kserve.io_localmodelcaches.yaml
- serving.kserve.io_localmodelnodegroups.yaml
- serving.kserve.io_localmodelnodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.2
name: clusterlocalmodels.serving.kserve.io
name: localmodelcaches.serving.kserve.io
spec:
group: serving.kserve.io
names:
kind: ClusterLocalModel
listKind: ClusterLocalModelList
plural: clusterlocalmodels
singular: clusterlocalmodel
kind: LocalModelCache
listKind: LocalModelCacheList
plural: localmodelcaches
singular: localmodelcache
scope: Cluster
versions:
- name: v1alpha1
Expand Down
22 changes: 11 additions & 11 deletions config/rbac/localmodel/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,33 @@ rules:
- apiGroups:
- serving.kserve.io
resources:
- clusterlocalmodels
- localmodelnodes
- inferenceservices
- localmodelnodegroups
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- serving.kserve.io
resources:
- clusterlocalmodels/status
- localmodelcaches
- localmodelnodes
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- serving.kserve.io
resources:
- inferenceservices
- localmodelnodegroups
- localmodelcaches/status
verbs:
- get
- list
- watch
- patch
- update
- apiGroups:
- serving.kserve.io
resources:
Expand Down
14 changes: 7 additions & 7 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@ rules:
- get
- patch
- update
- apiGroups:
- serving.kserve.io
resources:
- clusterlocalmodels
verbs:
- get
- list
- apiGroups:
- serving.kserve.io
resources:
Expand Down Expand Up @@ -172,3 +165,10 @@ rules:
- get
- patch
- update
- apiGroups:
- serving.kserve.io
resources:
- localmodelcaches
verbs:
- get
- list
2 changes: 1 addition & 1 deletion hack/generate-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ cp ${temp_dir}/serving.kserve.io_inferencegraphs.yaml charts/kserve-crd/template
cp ${temp_dir}/serving.kserve.io_servingruntimes.yaml charts/kserve-crd/templates/serving.kserve.io_servingruntimes.yaml
cp ${temp_dir}/serving.kserve.io_clusterstoragecontainers.yaml charts/kserve-crd/templates/serving.kserve.io_clusterstoragecontainers.yaml
cp ${temp_dir}/serving.kserve.io_localmodelnodegroups.yaml charts/kserve-crd/templates/serving.kserve.io_localmodelnodegroups.yaml
cp ${temp_dir}/serving.kserve.io_clusterlocalmodels.yaml charts/kserve-crd/templates/serving.kserve.io_clusterlocalmodels.yaml
cp ${temp_dir}/serving.kserve.io_localmodelcaches.yaml charts/kserve-crd/templates/serving.kserve.io_localmodelcaches.yaml

# Clean temp directory
rm -rf ${temp_dir}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

package v1alpha1

type ClusterLocalModelStatus struct {
type LocalModelCacheStatus struct {
// Status of the model on a node, like NodeDownloaded or NodeNotReady
NodeStatus map[string]NodeStatus `json:"nodeStatus,omitempty"`

Expand All @@ -33,7 +33,7 @@ type NamespacedName struct {
}

// NodeStatus enum
// +kubebuilder:validation:Enum="";NodeNotReady;NodeDownloadPending;NodeDownloading;NodeDownloaded;NodeDownloadError;NodeDeleting;NodeDeletionError;NodeDeleted
// +kubebuilder:validation:Enum="";NodeNotReady;NodeDownloadPending;NodeDownloading;NodeDownloaded;NodeDownloadError;
type NodeStatus string

// NodeStatus Enum values
Expand All @@ -43,9 +43,6 @@ const (
NodeDownloading NodeStatus = "NodeDownloading"
NodeDownloaded NodeStatus = "NodeDownloaded"
NodeDownloadError NodeStatus = "NodeDownloadError"
NodeDeleting NodeStatus = "NodeDeleting"
NodeDeletionError NodeStatus = "NodeDeletionError"
NodeDeleted NodeStatus = "NodeDeleted"
)

type ModelCopies struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// LocalModelCacheSpec
// +k8s:openapi-gen=true
type ClusterLocalModelSpec struct {
type LocalModelCacheSpec struct {
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="StorageUri is immutable"
// Original StorageUri
SourceModelUri string `json:"sourceModelUri" validate:"required"`
Expand All @@ -32,29 +33,31 @@ type ClusterLocalModelSpec struct {
NodeGroup string `json:"nodeGroup" validate:"required"`
}

// LocalModelCache
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope="Cluster"
type ClusterLocalModel struct {
type LocalModelCache struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ClusterLocalModelSpec `json:"spec,omitempty"`
Status ClusterLocalModelStatus `json:"status,omitempty"`
Spec LocalModelCacheSpec `json:"spec,omitempty"`
Status LocalModelCacheStatus `json:"status,omitempty"`
}

// LocalModelCacheList
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ClusterLocalModelList struct {
type LocalModelCacheList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterLocalModel `json:"items" validate:"required"`
Items []LocalModelCache `json:"items" validate:"required"`
}

func init() {
SchemeBuilder.Register(&ClusterLocalModel{}, &ClusterLocalModelList{})
SchemeBuilder.Register(&LocalModelCache{}, &LocalModelCacheList{})
}
Loading

0 comments on commit c9cc812

Please sign in to comment.