Skip to content

Commit

Permalink
feat: add support for modelmeshserving as component
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <wenzhou@redhat.com>
  • Loading branch information
zdtsw committed Nov 8, 2024
1 parent 10197da commit a833dd5
Show file tree
Hide file tree
Showing 26 changed files with 824 additions and 420 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ Example commands to run test suite for the dashboard `component` only, with the
make run-nowebhook
```
```shell
make e2e-test -e OPERATOR_NAMESPACE=<namespace> -e E2E_TEST_FLAGS="--test-operator-controller=false --test-webhook=false --test-component=dashboard"
make e2e-test -e OPERATOR_NAMESPACE=<namespace> -e E2E_TEST_FLAGS="--test-operator-controller=false --test-webhook=false --test-component=dashboard,modelmesh"
```


Expand Down
4 changes: 4 additions & 0 deletions apis/components/v1/kserve_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
ModelMeshCtrlerComponentName = "odh-model-controller" // shared by kserve and mm
)

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

Expand Down
54 changes: 34 additions & 20 deletions apis/components/v1/modelmeshserving_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,21 @@ import (
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.

// ModelMeshServingSpec defines the desired state of ModelMeshServing
type ModelMeshServingSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of ModelMeshServing. Edit modelmeshserving_types.go to remove/update
Foo string `json:"foo,omitempty"`
}
const (
ModelMeshServingComponentName = "model-mesh"
// value should match whats set in the XValidation below
ModelMeshServingInstanceName = "default-modelmesh"
ModelMeshServingKind = "ModelMeshServing"
)

// ModelMeshServingStatus defines the observed state of ModelMeshServing
type ModelMeshServingStatus struct {
components.Status `json:",inline"`
}
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:validation:XValidation:rule="self.metadata.name == 'default-modelmesh'",message="ModelMeshServing name must be default-modelmesh"
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`,description="Ready"
// +kubebuilder:printcolumn:name="Reason",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`,description="Reason"

// ModelMeshServing is the Schema for the modelmeshservings API
type ModelMeshServing struct {
Expand All @@ -51,16 +46,21 @@ type ModelMeshServing struct {
Status ModelMeshServingStatus `json:"status,omitempty"`
}

func (c *ModelMeshServing) GetDevFlags() *components.DevFlags {
return nil
// ModelMeshServingSpec defines the desired state of ModelMeshServing
type ModelMeshServingSpec struct {
ModelMeshServingCommonSpec `json:",inline"`
}

func (c *ModelMeshServing) GetStatus() *components.Status {
return &c.Status.Status
type ModelMeshServingCommonSpec struct {
components.DevFlagsSpec `json:",inline"`
}

// +kubebuilder:object:root=true
// ModelMeshServingStatus defines the observed state of ModelMeshServing
type ModelMeshServingStatus struct {
components.Status `json:",inline"`
}

// +kubebuilder:object:root=true
// ModelMeshServingList contains a list of ModelMeshServing
type ModelMeshServingList struct {
metav1.TypeMeta `json:",inline"`
Expand All @@ -71,3 +71,17 @@ type ModelMeshServingList struct {
func init() {
SchemeBuilder.Register(&ModelMeshServing{}, &ModelMeshServingList{})
}

func (c *ModelMeshServing) GetDevFlags() *components.DevFlags {
return c.Spec.DevFlags
}
func (c *ModelMeshServing) GetStatus() *components.Status {
return &c.Status.Status
}

// DSCModelMeshServing contains all the configuration exposed in DSC instance for ModelMeshServing component
type DSCModelMeshServing struct {
components.ManagementSpec `json:",inline"`
// configuration fields common across components
ModelMeshServingCommonSpec `json:",inline"`
}
36 changes: 35 additions & 1 deletion apis/components/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions apis/datasciencecluster/v1/datasciencecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"github.com/opendatahub-io/opendatahub-operator/v2/components/datasciencepipelines"
"github.com/opendatahub-io/opendatahub-operator/v2/components/kserve"
"github.com/opendatahub-io/opendatahub-operator/v2/components/kueue"
"github.com/opendatahub-io/opendatahub-operator/v2/components/modelmeshserving"
"github.com/opendatahub-io/opendatahub-operator/v2/components/trainingoperator"
"github.com/opendatahub-io/opendatahub-operator/v2/components/trustyai"
"github.com/opendatahub-io/opendatahub-operator/v2/components/workbenches"
Expand All @@ -52,8 +51,7 @@ type Components struct {
Workbenches workbenches.Workbenches `json:"workbenches,omitempty"`

// ModelMeshServing component configuration.
// Does not support enabled Kserve at the same time
ModelMeshServing modelmeshserving.ModelMeshServing `json:"modelmeshserving,omitempty"`
ModelMeshServing componentsv1.DSCModelMeshServing `json:"modelmeshserving,omitempty"`

// DataServicePipeline component configuration.
// Require OpenShift Pipelines Operator to be installed before enable component
Expand Down
179 changes: 0 additions & 179 deletions components/modelmeshserving/modelmeshserving.go

This file was deleted.

Loading

0 comments on commit a833dd5

Please sign in to comment.