-
Notifications
You must be signed in to change notification settings - Fork 181
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
Add model API #299
Open
varungup90
wants to merge
7
commits into
main
Choose a base branch
from
add-model-ai
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add model API #299
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
abd94e2
Add model API
varungup90 50bb12a
Merge branch 'main' into add-model-ai
varungup90 8a45ab5
cleanup
varungup90 a561c61
nit fix in init container command for redis check
varungup90 16267a9
add timeout for nc command for redis check
varungup90 abc26d7
Merge branch 'main' into add-model-ai
varungup90 e57d7e3
Merge branch 'main' into add-model-ai
varungup90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/* | ||
Copyright 2024 The Aibrix Team. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
v1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! | ||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
||
// ModelSpec defines the desired state of Model | ||
type ModelSpec struct { | ||
|
||
// Engine to be used for the server process. | ||
// +kubebuilder:validation:Enum=VLLM | ||
Engine string `json:"engine"` | ||
|
||
// Template describes the pods that will be created. | ||
// +kubebuilder:validation:Required | ||
Template v1.PodTemplateSpec `json:"template"` | ||
|
||
// Replicas is the desired number of replicas of model | ||
// +optional | ||
// +kubebuilder:default=1 | ||
Replicas *int32 `json:"replicas,omitempty"` | ||
} | ||
|
||
// ModelPhase is a string representation of the Model lifecycle phase. | ||
type ModelPhase string | ||
|
||
const ( | ||
// ModelPending means the CR has been created and that's the initial status | ||
ModelPending ModelPhase = "Pending" | ||
// ModelDeploying means the Model is being deployed | ||
ModelDeploying ModelPhase = "Deploying" | ||
// ModelResourceCreated means the model owned resources have been created | ||
ModelResourceCreated ModelPhase = "ResourceCreated" | ||
// ModelRunning means Model has been running on the pod | ||
ModelRunning ModelPhase = "Running" | ||
// ModelFailed means Model has terminated in a failure | ||
ModelFailed ModelPhase = "Failed" | ||
// ModelUnknown means Model clean up some stable resources | ||
ModelUnknown ModelPhase = "Unknown" | ||
) | ||
|
||
// ModelStatus defines the observed state of Model | ||
type ModelStatus struct { | ||
// Phase is a simple, high-level summary of where the Model is in its lifecycle | ||
// Phase maps to latest status.conditions.type | ||
// +optional | ||
Phase ModelPhase `json:"phase,omitempty"` | ||
// Conditions represents the observation of a model 's current state. | ||
// +patchMergeKey=type | ||
// +patchStrategy=merge | ||
// +optional | ||
Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
} | ||
|
||
type ModelConditionType string | ||
|
||
const ( | ||
ModelConditionTypeInitialized ModelConditionType = "Initialized" | ||
ModelConditionTypeDeployed ModelConditionType = "Deployed" | ||
ModelConditionTypeResourceCreated ModelConditionType = "ResourceCreated" | ||
ModelConditionReady ModelConditionType = "Ready" | ||
) | ||
|
||
// +genclient | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// Model is the Schema for the models API | ||
type Model struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec ModelSpec `json:"spec,omitempty"` | ||
Status ModelStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// ModelList contains a list of Model | ||
type ModelList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []Model `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&Model{}, &ModelList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this is very thin layer. If we use PodTemplate, do we still have control on the sidecar and engine?
SGLang
in pod template but specify the vLLM as the engine type?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.