Repository: vllm-project/aibrix
File: api/model/v1alpha1/modeladapter_types.go (Go)

Code before:
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 (
	corev1 "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.

// ModelAdapterSpec defines the desired state of ModelAdapter
type ModelAdapterSpec struct {

	// BaseModel is the identifier for the base model to which the ModelAdapter will be attached.
	// +optional
	BaseModel string `json:"baseModel,omitempty"`

	// PodSelector is a label query over pods that should match the ModelAdapter configuration.
	// +kubebuilder:validation:Required
	PodSelector *metav1.LabelSelector `json:"podSelector,omitempty"`

	// SchedulerName is the name of the scheduler to use for scheduling the ModelAdapter.
	// +optional
	// +kubebuilder:default=default
	SchedulerName string `json:"schedulerName,omitempty"`

	// ArtifactURL is the address of the model artifact to be downloaded. Different protocol is supported like s3,gcs,huggingface
	// +kubebuilder:validation:Required
	ArtifactURL string `json:"artifactURL,omitempty"`

	// CredentialsSecretRef points to the secret used to authenticate the artifact download requests
	// +optional
	CredentialsSecretRef *corev1.LocalObjectReference `json:"credentialsSecretRef,omitempty"`

	// Replicas is the desired number of replicas of model adapter
	// +optional
	// +kubebuilder:default=1
	Replicas *int32 `json:"replicas,omitempty"`


Review comment (suggestion):
The original design here is to refer a model. but we didn't add the model CRD here (due to the reason I synced with you earlier). 
I feel there're two options
1. Once we have the model api, baseModel can ref that object.
2. at this moment, we probably can leverage PodSelector or objectRef to upgrade the `PodSelector`.

one of above should be specified

This would be a design discussion and I would like to know your thoughts here

Code after:
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 (
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// NOTE: json tags are required.  Any new fields you add must have json tags for the fields to be serialized.

// ModelAdapterSpec defines the desired state of ModelAdapter
type ModelAdapterSpec struct {

	// BaseModel is the identifier for the base model to which the ModelAdapter will be attached.
	// +optional
	BaseModel *string `json:"baseModel,omitempty"`

	// PodSelector is a label query over pods that should match the ModelAdapter configuration.
	// +kubebuilder:validation:Required
	PodSelector *metav1.LabelSelector `json:"podSelector,omitempty"`

	// SchedulerName is the name of the scheduler to use for scheduling the ModelAdapter.
	// +optional
	// +kubebuilder:default=default
	SchedulerName string `json:"schedulerName,omitempty"`

	// ArtifactURL is the address of the model artifact to be downloaded. Different protocol is supported like s3,gcs,huggingface
	// +kubebuilder:validation:Required
	ArtifactURL string `json:"artifactURL,omitempty"`

	// CredentialsSecretRef points to the secret used to authenticate the artifact download requests
	// +optional
	CredentialsSecretRef *corev1.LocalObjectReference `json:"credentialsSecretRef,omitempty"`

	// Replicas is the desired number of replicas of model adapter
	// +optional
	// +kubebuilder:default=1
	Replicas *int32 `json:"replicas,omitempty"`

	// Additional fields can be added here to customize the scheduling and deployment